Skip to content

Support React.ElementConfig #228

@nathantalewis

Description

@nathantalewis

This seems very similar to #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)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions