React propTypes - no autocomplete with component composition

I define propTypes to each component I write, and WebStorm then auto completes the props when use the component.

React recommends component composition as opposed to inheritance.

So, whenever I use a higher-order component (X) within another component (Y), I want X's propTypes to be included Y's propTypes.

I do this:

Y.propTypes = {

...X.propTypes,

id: PropTypes.string,

}

but when I create an instance of Y, only "id" prop is auto-completed.

 

0
1 comment

Please vote for https://youtrack.jetbrains.com/issue/WEB-22063 to be notified on any progress with this issue

0

Please sign in to leave a comment.