Background
When writing a Higher-order component in react that contains a decorator my highlighting is broken in PhpStorm/WebStorm.
Example Code
export default function HOC(WrappedComponent) {
return (
@connect(
state => ({
data: state.data
})
)
class extends Component {/** react component **/}
)
}
The Error
This piece of code compiles perfectly in my react application but causes a whole bunch of errors in my IDE.
If I remove the decorator the errors go away. But if I use decorators on other components there is no problem with the highlighting. Meaning that it is not a global issue with decorators.
The first error flagged is
) expected, line 19 (where line 19 is the end of the decorator)
This means its that the return statement does not understand the grouping of the decorator and the component correctly.
Question
Is there a way to fix this issue easily, maybe a library. Or should I change the way I write these HOCs?