Search code examples
typescriptwebstorm

Random errors in TypeScript class


I detected a very strange behaviour in WebStorm 2017.2 while editing a TypeScript file.

In a specific line an error is displayed, that does not make any sense. In line 107 it says

TS2339:Property '_' does not exist on type 'NjPropertiesBoSettings'.

But I imported lodash as

import * as _ from 'lodash';

When I now add a linebreak before that error line, the error is gone.

Error

enter image description here

new line and the error wanders

enter image description here

new line and the error is gone

enter image description here

Has anybody an idea what the problem here? I only got WebStorm errors, the TypeScript compiler does not mention anything.

EDIT

I found the reason. I disabled the "Use TypeScript Service" checkbox unter Settings->Languages & Frameworks->TypeScript.

Seemingly this causes the error, because I am not building a Angular2+ project.

Note

I will leave this here, in case someone runs into the same issue.


Solution

  • I found the reason. I disabled the "Use TypeScript Service" checkbox unter Settings->Languages & Frameworks->TypeScript.

    Seemingly this causes the error, because I am not building a Angular2+ project.