Typescript unresolved variable classList

Windows 7 x64
Phpstorm 9 EAP build 141.1619 x64

I am getting unresolved variable error in the editor for classList in a typescript file
Code the causes error:

myfunc() {

1) Is there a place in the settings where we can override this errror for typescript or add it to an excluded list?
2)What does the editor validate against for typescript errors? For example javascript uses jslint or jshint for editor errors, correct?

From looking at the typescript folder lib.d.ts classList is defined but I am also getting a similar error when I compile. So maybe it is a problem with the lib.d.ts file.  

error TS2339: Property 'classList' does not exist on type 'Node'.

Comment actions Permalink

In TypeScript 1.5

is defined to return
array, and Node indeed doesn't have 'classList'   - thus the error. See https://github.com/Microsoft/TypeScript/issues/3613.

What does the editor validate against for typescript errors?

It uses its own TypeScript parser. But if either TypeScript compiler or TypeScript file watcher is set up, PHPStorm own error highlighting is suppressed and errors coming from TypeScript compiler are shown instead

For example javascript uses jslint or jshint for editor errors, correct?

No, not correct. JSLint/JSHint/other standard linters are used in addition to PHPStorm own inspections (based on proprietary JavaScript parser) if linters are configured in Settings/Languages & Frameworks/JavaScript/Code Quality Tools

Comment actions Permalink

Ok, thank you for the info very helpful.

So since it looks like it is defined incorrectly in Typescript(as the code is valid and should not be thowing an error without having to cast it to another type, which is not pratical), is there a way for now to override this error and add it to exception list. Example in Editor/Inspections/Css/Invalid Elements there is an unkown element option that you can manually add unkown elements to in order to fix false validation errors, is there something like this for Typescript?

Comment actions Permalink

Errors that come from TypeScript compiler can't be suppressed. I can only suggest turning the compiler off to avoid seeing them

Comment actions Permalink

Ok, thanks again, you have been very helpful.  Hope you have a nice day!


Please sign in to leave a comment.