Floriane
Floriane

Reputation: 701

Language TypeScript not recognized by WebStorm

By reopening my typescript project, I realize that I am full of error of this type:

TSLint: " should be ' (quotemark)
TSLint: Type boolean trivially inferred from a boolean literal, remove type annotation (no-inferrable-types)
TSLint: for (... in ...) statements must be filtered with an if statement (forin)
TSLint: unused expression, expected an assignment or function call (no-unused-expression)

As if WebStorm no longer recognized the TypeScript language .. I do not see how to do knowing that before I had no error and I could build my project without problems.

Upvotes: 0

Views: 882

Answers (2)

lena
lena

Reputation: 93748

TypeScript support is definitely there:) The errors come from TSLint - WebStorm auto-enables TSLint integration if 'tslint' package is listed in project dependencies in package.json. You can disable the integration in Settings | Languages & Frameworks | TypeScript | TSLint if you don't like to see the warnings, or edit your tslint config, or synchronize your WebStorm code style preferences with TSLint rules by importing code style from config. You can also use TSLint auto-fixes to fix the errors. See Integration with TSLint for more information on using TSLint in WebStorm

Upvotes: 1

BlueM
BlueM

Reputation: 3851

The “T” in “TSLint” stands for TypeScript, which should be proof enough that WebStorm knows TypeScript very well.

The “error” you see are not errors, but warnings emitted by the TypeScript linter. Probably you have enabled TSLint in WebStorm and therefore you could just turn it off to get rid of the warnings. But of course, it would be better to fix the warnings (partially this is just code style, but also error prevention) or – if you know what and why you are doing it – to finetune the contents of your tslint.json file, where the linting is configured.

Upvotes: 3

Related Questions