False TypeScript error markers

Has anyone had any luck getting WebStorm to understand TypeScript? I'm using 9.0.2 (eval) and 8.0.4 (licensed), and even the simple example below seems to throw WebStorm off track. "f.color" is error highlighted with "unresolved variable". Symbol name completion does not work (typing "f." does not offer me "color"), go to declaration does not work, refactoring does not work on any TypeScript class or interface members.

Even though the code compiles without error, the right hand margin of the editor is filled with false error markers.

Am I missing something, or is this functionality simply not yet implemented?

-Ron.

interface Fruit {
  color: string;
}

function makeFruitGreen( f : Fruit ) : void {
  f.color = 'green';
}

9 comments

The plot thickens: it appears that the problem is local to a particular file. Exactly the same code in a different file is parsed correctly. Both files have the .ts file extension.

What could be the problem and how do I fix it?

-Ron.

0

Hi there,

Please try "File | Invalidate Caches..." and restart IDE if you have not tried it yet.

0

Thank you for that suggestion. But the problem persists after that operation.

-Ron.

0

Please provide a screenshot of that file (whole editor window, including editor tab).

If possible -- attach that file here as well (actually attach and not copy-paste its content).

0

More clues: the behavior changes depending of the location of the file. I created a file named fruitLib.ts, with exactly and only the content below. WebStorm parses the source code correctly when the file is in most locations, but when I move it into a specific folder, it adds a false error marker on the line "f.color = c;"

-Ron.

 
module fruitLib {
  export interface Fruit {
    color: string;
  }
  export function setColor( f : Fruit, c: string ) {
    f.color = c;
  }
}
export = fruitLib;
0

This is a small file that demonstrates the problem. Screenshot and source file attached.

(BTW "Insert Image" in the message editor didn't work for me - unrelated problem)

-Ron.



Attachment(s):
fruitLib.ts.zip
Screenshot 2015-01-09 08.41.40.png
0

I've tried everything that I knew .. but could not find anything that may produce such behaviour (but then -- I'm not an expert in TypeScript; was rather relying on general JS knowledge/usage in WS).

The only other thing I may think of right now is:

  1. Check your Inspector guy (the icon in status bar) -- looks like some stuff is disabled.
  2. Backup and delete your project settings (while project is closed in IDE) -- your .idea subfolder. Now open that folder in IDE and see if issue will re-appear. If it's gone -- re-configuring project should not take too much of a time.
0

Please attach a full project then (with the file placed in this specific folder:))

0

Thanks, but I have found a workaround. I renamed the folder, and the problem has gone away. (At least, for the moment)

-Ron.

0

Please sign in to leave a comment.