You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Cannot read property 'type' of undefined
TypeError: Cannot read property 'type' of undefined
at /path/to/src/node_modules/eslint-plugin-react/lib/rules/forbid-prop-types.js:59:14
at Array.forEach (native)
at checkForbidden (/path/to/src/node_modules/eslint-plugin-react/lib/rules/forbid-prop-types.js:55:18)
at EventEmitter.ClassProperty (/path/to/src/node_modules/eslint-plugin-react/lib/rules/forbid-prop-types.js:89:9)
at emitOne (events.js:82:20)
at EventEmitter.emit (events.js:169:7)
at NodeEventGenerator.enterNode (/path/to/src/node_modules/eslint/lib/util/node-event-generator.js:42:22)
at CodePathAnalyzer.enterNode (/path/to/src/node_modules/eslint/lib/code-path-analysis/code-path-analyzer.js:609:23)
at CommentEventGenerator.enterNode (/path/to/src/node_modules/eslint/lib/util/comment-event-generator.js:99:23)
at Controller.traverser.traverse.enter /path/to/src/node_modules/eslint/lib/eslint.js:887:36)
This happens if I import props from another file and then define another prop in a Component. Like this:
import React from 'react';
import propTypes from './test.propTypes';
class Test extends react.component {
static propTypes = {
intl: React.propTypes.number,
...propTypes
};
}
eslint version 2.8.0
The text was updated successfully, but these errors were encountered:
The problem lies in the destructuring of the imported propTypes object. To work aroung this issue, just move the intl propType into the test.propTypes file.
import React from 'react';
import propTypes from './test.propTypes'; // contains 'intl: React.propTypes.number'
class Test extends react.component {
static propTypes = propTypes;
}
Cannot read property 'type' of undefined
TypeError: Cannot read property 'type' of undefined
at /path/to/src/node_modules/eslint-plugin-react/lib/rules/forbid-prop-types.js:59:14
at Array.forEach (native)
at checkForbidden (/path/to/src/node_modules/eslint-plugin-react/lib/rules/forbid-prop-types.js:55:18)
at EventEmitter.ClassProperty (/path/to/src/node_modules/eslint-plugin-react/lib/rules/forbid-prop-types.js:89:9)
at emitOne (events.js:82:20)
at EventEmitter.emit (events.js:169:7)
at NodeEventGenerator.enterNode (/path/to/src/node_modules/eslint/lib/util/node-event-generator.js:42:22)
at CodePathAnalyzer.enterNode (/path/to/src/node_modules/eslint/lib/code-path-analysis/code-path-analyzer.js:609:23)
at CommentEventGenerator.enterNode (/path/to/src/node_modules/eslint/lib/util/comment-event-generator.js:99:23)
at Controller.traverser.traverse.enter /path/to/src/node_modules/eslint/lib/eslint.js:887:36)
This happens if I import props from another file and then define another prop in a Component. Like this:
eslint version 2.8.0
The text was updated successfully, but these errors were encountered: