DEV Community

Discussion on: Type checking your JavaScript with VS Code - the superpowers you didn't know you had

Collapse
 
functional_js profile image
Functional Javascript

Good work Chris.

Tip:

a.
create a tsconfig.json file in the root of your project or monorepo, and add...

"allowJs": true /* Allow javascript files to be compiled. */,
"checkJs": true /* Report errors in .js files. */,

and you won't ever need... // @ts-check

b.
Type your data with JSDoc.
Now you have all the Typescript services, while keeping your code pure JavaScript.
The best of both worlds.

Example:
Alt Text

Collapse
 
softchris profile image
Chris Noring • Edited

hey.. thanks.. yea that exist as well.. Just wanted to give people the "try before you buy experience". But you are right a config file is better.