7.4.0-rc.0 flow imported type intersection error - Cannot read property 'length' of undefined in prop-types.js
See original GitHub issueWe are heavy flow users and are on flow 0.54.0, so I assume this may be related to @jseminck’s changes in #1400. This may be an entirely new case or separate bug.
yarn list eslint-plugin-react eslint ⏎
yarn list v0.27.5
├─ eslint-plugin-react@7.4.0-rc.0
└─ eslint@4.5.0
git clone https://github.com/alienfast/material-ui.git
git checkout remove-class-property-props
yarn install
yarn lint
Cannot read property 'length' of undefined
TypeError: Cannot read property 'length' of undefined
at iterateProperties (/Users/kross/projects/material-ui/node_modules/eslint-plugin-react/lib/rules/prop-types.js:365:21)
at propTypes.types.forEach.annotation (/Users/kross/projects/material-ui/node_modules/eslint-plugin-react/lib/rules/prop-types.js:798:13)
at Array.forEach (<anonymous>)
at markPropTypesAsDeclared (/Users/kross/projects/material-ui/node_modules/eslint-plugin-react/lib/rules/prop-types.js:796:27)
at markAnnotatedFunctionArgumentsAsDeclared (/Users/kross/projects/material-ui/node_modules/eslint-plugin-react/lib/rules/prop-types.js:911:7)
at Object.handleStatelessComponent (/Users/kross/projects/material-ui/node_modules/eslint-plugin-react/lib/rules/prop-types.js:920:7)
at Linter.updatedRuleInstructions.(anonymous function) (/Users/kross/projects/material-ui/node_modules/eslint-plugin-react/lib/util/Components.js:666:75)
at emitOne (events.js:120:20)
at Linter.emit (events.js:210:7)
at NodeEventGenerator.applySelector (/Users/kross/projects/material-ui/node_modules/eslint/lib/util/node-event-generator.js:265:26)
It appears to be failing when visiting IntersectionTypeAnnotation
:
How can I help narrow this down further?
Issue Analytics
- State:
- Created 6 years ago
- Reactions:5
- Comments:13 (10 by maintainers)
Top Results From Across the Web
TypeError: Cannot read property 'PropTypes' of undefined ...
First of all, give up on importing PropTypes from react . It is deprecated. Instead, start using import PropTypes from 'prop-types The rest ......
Read more >typeerror: cannot read property 'location' of undefined jest
I found that I can mock the React Router hooks like useLocation using the following pattern: import React from "react ...
Read more >Typeerror: Cannot Read Property 'length' of Undefined
The length property returns a number for essentially any object in JavaScript. Typeerrors can be thrown when attempting to change a value that ......
Read more >3101543-18-REROLL.patch - Drupal
isArray(arr)) { for (var i = 0, arr2 = new Array(arr.length); i < arr.length; ... Drupal); \ No newline at end of file...
Read more >Compare Versions | pangling | npm - Open Source Insights
GHSA-vfrc-7r7c-w9mxPrototype Pollution in highlight.js ... @babel/plugin-transform-flow-strip-types 7.19.0 ... @types/prop-types 15.7.5.
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
@bsr203 see my last comment. I just pushed a fix to my branch and tested it on the material-ui project and now everything passes 🎉
I still have to clean up the code though… it’s a bit messy.
To try it out (or
npm i --save-dev
if you use npm)hi @yannickcr
I get a different stack this time.