diff --git a/lib/util/propTypes.js b/lib/util/propTypes.js index 283e969284..8d47b2563b 100644 --- a/lib/util/propTypes.js +++ b/lib/util/propTypes.js @@ -612,7 +612,7 @@ module.exports = function propTypesInstructions(context, components, utils) { annotation = annotation.typeAnnotation; } - if (annotation.type === 'GenericTypeAnnotation' && getInTypeScope(annotation.id.name)) { + if (annotation && annotation.type === 'GenericTypeAnnotation' && getInTypeScope(annotation.id.name)) { return getInTypeScope(annotation.id.name); } return annotation; diff --git a/tests/lib/rules/prop-types.js b/tests/lib/rules/prop-types.js index a16ad51293..d33363bec6 100755 --- a/tests/lib/rules/prop-types.js +++ b/tests/lib/rules/prop-types.js @@ -1805,6 +1805,20 @@ ruleTester.run('prop-types', rule, { } } `, + settings: {react: {flowVersion: '0.52'}}, + parser: 'babel-eslint' + }, { + code: ` + type Props = { + foo: string, + }; + + class Bar extends React.Component { + render() { + return
{this.props.foo}
+ } + } + `, settings: {react: {flowVersion: '0.53'}}, parser: 'babel-eslint' }, {