Search code examples
reactjswebstormreact-proptypes

WebStorm inspector throws "Unresolved variable isRequired" for ReactJS PropTypes


WebStorm (2019.1.3) throws the warning: "Unresolved variable isRequired" for ReactJS (16.8.6) PropTypes. How to solve this warning?

WebStorm warning

Settings.propTypes = {
  onClose: PropTypes.func.isRequired,
  isSettingsOpen: PropTypes.bool.isRequired,
};

React PropTypes has property isRequired (https://reactjs.org/docs/typechecking-with-proptypes.html#proptypes).

prop-types (^15.7.2) npm package installed into "dependencies".

Thanks for any help in advance.


Solution

  • I know this is old, but kept running into this and figured I would help others. I found this GitHub issue with a solution that worked for me.

    Webstorm 2019.2+ (Tested w/ IntelliJ 2019.3)

    Follow these steps:

    1. Go to Settings/Preferences > Languages & Frameworks > JavaScript > Libraries
    2. Go to Download..
    3. Search for "prop-types" (I had to scroll down an alphabetical-ordered list) enter image description here
    4. Click Download and Install
    5. Click Ok enter image description here