WebStorm \ TypeScript errors

Certain typescript files seem to, once in a while, decide that they have errors inside them when they really do not. For example, I have a class that has some fields of type 'kendo.ui.WindowOptions' (and yes I have the type defs):

interface IMyClass {

    MyWindow:kendo.ui.WindowOptions;

}

class MyClass {

    MyWindow = {title: 'Example'};

}

WebStorm will say the class does not implement the interface. And I have other files doing the same thing with no error. It only happens in a few files and only once in a while, on and off. If I retype the files with the same code sometimes the errors go away for a while. It is really strange behavior. Is there anything I can do to make the errors go away?

3 comments

Error that go away on re-typing is a usual symptom of broken indexes... Please try invalidating caches (File/Invalidate caches, Restart) - does the problem persist?

0

It is weird as the problem shows up and then goes away intermittently. After writing my opening post I went back to what I was working. When I saw you replied I checked the issue and it had cured itself (i.e. it stopped complaining). I restarted web storm and now the same file is being flagged by web storm as having the error described above again. Next I followed your instructions and invalidated the cache and restart. Once the indexing finishes the same file is being flagged as described in the opening post.

0

Please sign in to leave a comment.