webstorm: what does "Element is not exported" warning mean?

ya_dimon picture ya_dimon · Apr 17, 2016 · Viewed 24.3k times · Source

if i write such code in webstorm

export class someOne {
  constructor(param) {
    this.test = param;
  }

  useTest(){
    return this.test;
  }
}


console.log(new someOne(123).useTest());

and mouseover on "this.test" i see the warning: "Element is not exported"

element is not exported wtf

what does it mean? if i change the .test to .test1 the warning disappears

Answer

Fabian picture Fabian · Jun 15, 2016

For me it worked to mark all "private" properties with a prefixed underscore. Obviously Webstorm/IntelliJ recognized the properties as something that should not be exported.

export class someOne {
  constructor(param) {
    this._test = param;
  }

  useTest(){
    return this._test;
  }
}


console.log(new someOne(123).useTest());