Vue + TypeScript: type-checking is not working at all in script block

In my script block (which has lang="ts"), I have the following code:

let foo = 2;
foo = 'hi';

It's not complaining about this at all. Also, whenever I use interfaces I've created, it doesn't validate use of those types either:

const thisIsWrong: Track = {
huff: 'puff',
fake: 'field',
};

There are no problems in .ts files, only with .vue files.

0

What IDE version do you work with? It works fine for me in 2020.2, with Typescript language service enabled:

 

 

and disabled:

0

It's working ok now! Really weird. I think restarting WebStorm might've fixed it.

0

Great, thanks for letting me know:)

0

This is happening for me too. A restart and an Invalidate Cache/Restart isn't working for me. This has always happened in *.vue files.

 

Just to clarify, this happens inside a <script lang="ts"> block and it has Typescript language service enabled. 

0

请先登录再写评论。