The superclass constructor call must be in the constructor body

I am writing a React class constructor using es6, but in the webstorm9 editor there is a red highlight here is part of the code:

class AssetSelectDialog extends React.Component {
static propTypes = {
    data: React.PropTypes.any,
    pageState: React.PropTypes.string,
    pageStatus: React.PropTypes.string,
    handleCancel: React.PropTypes.func,
    handleSave: React.PropTypes.func
};

constructor(props) {
    super(props);
    this.PAGE_STATUS = {
        SHOW: 'SHOW',
        SELECT: 'SELECT'
    };
    this.state = {
        data: this.props.data || {},
        pageState: this.props.pageState || CONST.STATUS.EDIT,
        pageStatus: this.props.pageStatus || this.PAGE_STATUS.SHOW 
    };
}

in the super(props);error was detected, and the message Superclass constructor invocation should be in constructor body. The code runs fine in babel., how can I fix it?

+4
source share
1 answer

WebStorm 10.0.4 fixed a bug in WebStorm, WEB-14601

+6
source

Source: https://habr.com/ru/post/1608407/


All Articles