React component props no longer resolve 2017.2

Before updating to 2017.2 a month ago, WebStorm would happily auto complete and link (cmd+click) props which were defined on the propTypes property of a class or in mapStateToProps/mapDispatchToProps.

All of my class components are now littered with yellow underlines which say "unresolved function or method methodName()" or "unresolved variable variableName". Did something change? I tried deleting my .idea directory, but that has not solved it. I also tried defining them as a static property of the class, but that doesn't resolve them either.

Here's an example of something that worked previously, but no longer does.

 

import React, { Component } from 'react';
import PropTypes from 'prop-types';

class TestComponent extends Component {
render() {
return (
<div>{this.props.children}</div>
);
}
}

TestComponent.propTypes = {
children: PropTypes.node.isRequired,
};

export default TestComponent;

 

 

 

0
2 comments

may be related to https://youtrack.jetbrains.com/issue/WEB-29841; please make sure to remove/disable react typings (@types/react) - check Settings | Languages & Frameworks | JavaScript | Libraries preferences and local node_modules folder for presence of these typings

1
Avatar
Permanently deleted user

Thank you Elena! Deleting node_modules/@types/react solved this.

0

Please sign in to leave a comment.