Issue
Using VS Code, when I make mistake in Typescript it highlights the error as "Cannot find name" / any, but in Javascript it is assigned "any" and therefore it is not an highlighted. Image attached:
Is it possible to highlight in JavaScript the errors in same way? JSlint extension did not help. It would be painful to see the errors only in build.
Solution
TypeScript by default squelches these errors when you're in a .js
file - however, if you add a // @ts-check
comment to the top of your .js
file, then you should get a similar form of checking as you would in TypeScript.
This is fairly new, but you can get details on it from the official blog post.
The summary is
- Either add a
// @ts-check
comment to the top of your file, or - add the
checkJs
option to yourjsconfig.json
/tsconfig.json
Answered By - Daniel Rosenwasser
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.