brigand / brigand/babel-plugin-flow-react-proptypes

Support `React.ElementConfig`

Open
#228 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
427
Forks
42
PR merge metrics
No merged PRs in 30d

Description

This seems very similar to https://github.com/brigand/babel-plugin-flow-react-proptypes/issues/147. React now also provides `ElementConfig` that works almost the same as `ElementProps` but preserves the optionality of default props. Documentation at https://flow.org/en/docs/react/types/#toc-react-elementconfig

Trying to use `ElementConfig` thows the following in version 26.0.0:
```
ERROR in ./file.js
Module build failed (from ./node_modules/babel-loader/lib/index.js):
TypeError: /file.js: Cannot read property 'forEach' of undefined
at convertToPropTypes (/node_modules/babel-plugin-flow-react-proptypes/lib/convertToPropTypes.js:222:19)
at /node_modules/babel-plugin-flow-react-proptypes/lib/convertToPropTypes.js:164:22
at Array.forEach ()
at convertToPropTypes (/node_modules/babel-plugin-flow-react-proptypes/lib/convertToPropTypes.js:160:23)
at convertNodeToPropTypes (/node_modules/babel-plugin-flow-react-proptypes/lib/index.js:48:45)
at getPropsForTypeAnnotation (/node_modules/babel-plugin-flow-react-proptypes/lib/index.js:55:13)
at functionVisitor (/node_modules/babel-plugin-flow-react-proptypes/lib/index.js:452:121)
at PluginPass.ArrowFunctionExpression (/node_modules/babel-plugin-flow-react-proptypes/lib/index.js:601:16)
at newFn (/node_modules/@babel/traverse/lib/visitors.js:179:21)
at NodePath._call (/node_modules/@babel/traverse/lib/path/context.js:55:20)
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.