WebStorm inspector issues warning when initializing React state with ES6

I am working on a React web application and recently upgraded from WebStorm 10 to 2016.1. I am pleased with the new version so far, with the exception of a few inspirational quirks, which I would prefer not to attend if I can help, one of which I could not find a fix.

I use ES6 classes to declare all of my React components, and in every instance where I set the state, WebStorm throws an unresolved variable warning in the method .state.

The code for the fragment in question:

import React from "react";
import autobind from 'autobind-decorator';

@autobind
class List extends React.Component{
  constructor() {
    super();

    this.state = {
      name: "List",
      items: {},
      history: {},
      suggestions: [],
      highlightIndex: 0,
      suggestionsHover: false,
      autoDelete: true,
      delta: 0,
      mouse: 0,
      isPressed: false,
      lastPressed: 0,
      order: []
    }
  }

Warning:

Unresolved variable state

, WebStorm 10 (.. .setState). , babelify ES5, autobind-decorator, .

. , .

+4
3

TypeScript. TypeScript. JetBrains :

https://blog.jetbrains.com/webstorm/2015/10/working-with-reactjs-in-webstorm-coding-assistance/

, WebStorm. : Languages & Frameworks > JavaScript > Libraries Download. React ( , ), Download & Install. .

, WebStorm PropTypes props, " //".

+7

.

​​ 2016.2 (. https://youtrack.jetbrains.com/issue/WEB-20884).

, this.state, this.props .

+3

You need to add the details to your constructor

constructor(props) {
super(props);
-1
source

All Articles