Setting up type checking for JavaScript
npm install typescript --save-devinstalls TypeScript locallynpx tsc --init --allowJs --checkJs --noEmitcreates tsconfig.json- Add
"check-types": "npx tsc"to thescriptsobject in package.json - Run
npm run check-typesto check types
Type annotations can be written with JSDoc syntax. I often refer to Jsdoc cheatsheet.