Webstorm marks duplicate identifier error for variables from separate files

Using Webstorm 2017.3.1.

Webstorm will mark a class as a "duplicate identifier" if the same name is used in two separate files in the same project.

If I declare "class A" in "sandbox1.ts", and "class A" in "sandbox2.ts", class "A" is marked as a duplicate identifier in both files.

If I comment out "class A" in either file, the error goes away.

If I close one of the files, the error goes away.

These are not global variables, as the resulting javascript files will be loaded by different html files.

Any way to NOT consider these global?

Thanks,

Bob Wirka

0
3 comments

Update: This happens when BOTH files are open in the editor. If you close one of the files, the error goes away...

1

Webstorm can't know when/how you will use your classes in runtime. All them are in global scope unless you use modules

0

Elena,

Thank you for your response.

I've done modules before; will do it again.

Best,

Bob Wirka

0

Please sign in to leave a comment.