In VSCode, if I write this JS file:
/** @type {number} */
let x = 10;
/** @type {string} */
let y = x;
nothing is underlined in red, and the tooltip over y
simply gives let y: string
. That is not what I want! I want VSCode to throw me an error, as it does in a TS file:
let x: number = 10;
let y: string = x;
In the file above, y
is underlined in red and the tooltip when hovering over it gives TS2332: Type 'number' is not assignable to type 'string'
How can I achieve that? Should I tweak a VSCode setting? Should I use a particular ESLint or JSHint feature?