user5695186
user5695186

Reputation:

Make PhpStorm recognize react props

In my current PhpStorm setup, some react property fields are marked as unresolved while others aren't:

PhpStorm Screenshot of the problem

I find this very confusing because it implies to me that my props.value is OK while my props.onClick isn't. When I Cmd + Click on props.value I am lead to some unrelated code.

Because I currently do not define the property fields anywhere (I don't use TypeScript), I understand that it would be difficult for the IDE to recognize "the correct" property fields. However I would like to at least disable any kind of validation for property fields and omit the misleading suggestion that some fields are OK and others aren't.

Do you have any suggestions?

Upvotes: 0

Views: 289

Answers (1)

lena
lena

Reputation: 93868

Props resolving/completion is only supported for components with explicit propTypes declaration (see WEB-31785). As exact match can't be found, the IDE tries to match the property by name only, thus resolving it to some unrelated stuff:(

Upvotes: 2

Related Questions