Need help with diagnosing IntelliSense issue with TypeScript

I have a weird issue where the following (TypeScript) code fragment is reporting an error in WebStorm:


var arr:string[];
arr = [];
arr.push('mystring'); // error: Argument types do not match parameters

This is very basic TypeScript that compiles correctly with the TypeScript compiler on the command line (without errors).
It also validates when creating a new project in WebStorm with a .ts file with above code.

The same file does not validate (any more?) in my current project.



How does the built-in IntelliSense support for TypeScript work? Does it use an external TypeScript compiler?

Note: I have a rather custom setup with FileWatchers and I also have a locally installed TypeScript compiler.

I have no idea what affects/can affect the IntelliSense validation.

The file only contains the lines above, so there shouldn't be any interference with other TypeScript files in the project.

Can anybody shed some light on this?

Not sure how I can track down this problem.

Thx

5 comments

Just wanted to add that actually ALL array methods are reported as invalid, e.g. 'slice', 'indexOf', etc

0

Hi Matthew,

no, WebStorm doesn't use external compiler for IntelliSense.
Did you check if invalidating caches helps (File/Invalidate caches)?
If this doesn't help, could you, please, try to create a sample project that shows up the problem?


Best regards,
Lena

0

No, invalidating the caches didn't help. Thx for the hint though.

If I setup a new (empty) project the problem does not occur.

I was hoping for some pointers to what project settings/features could affect the IntelliSense compiler so I can track down the 'offender' more easily.

0

Hi Matthew,

extending standard types might also be the issue - see comments in http://youtrack.jetbrains.com/issue/WEB-2062
What javascript libraries are enabled for your project?

Best regards,
Lena

0

After excluding a directory containing a nodejs module (with a couple of dependencies) from the project the problem seems to be solved.

Shortly after that, a similar problem appeared ('.push' being marked as having an icorrect parameter type). This was due to having the typescript codeplex project (sources) under my project root. I fixed it by excluding the typescript directory.

Thx for the pointers.

0

Please sign in to leave a comment.