'Element is not exported' warning on member in es6 exporting default class.

I get "Element is not exported" warning on following code.

export default class{
constructor() {
this.bar = 1;
}
plus2() {
return this.bar + 2;
}
}

 

but another code following does not get the warning.

class Foo {
constructor() {
this.bar = 1;
}
plus2() {
return this.bar + 2;
}
}

export default Foo;

To write code as first one, should I make change for any setting?

The warning appears on WebStorm, PHPStorm, and IntelliJ Idea.

 

 

 

 

0
2 comments

Please follow https://youtrack.jetbrains.com/issue/WEB-43860 for updates.

For now, I can suggest to either change the way the class is declared/exported or suppress the inspection:

plus2() {
// noinspection JSUnresolvedVariable
return this.bar + 2;
}
0
Avatar
Permanently deleted user

Thanks Elena.

I will modify code a way declared/exported as you suggested.

0

Please sign in to leave a comment.