babel-plugin-flow-react-proptypes icon indicating copy to clipboard operation
babel-plugin-flow-react-proptypes copied to clipboard

Support `React.ElementConfig`

Open nathantalewis opened this issue 3 years ago • 0 comments

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 (<anonymous>)
    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)

nathantalewis avatar Aug 03 '20 18:08 nathantalewis