Type checking with JSDoc
Being able to catch bugs at compile time is a nice way to shorten feedback loop, thus become more productive. TypeScript provides static type checking. One way of integrating it in an app is refactoring entire app and adding type definition where those are needed. In some bigger apps this might take a noticeable effort.
Since TypeScript 2.3, an alternative solution has been developed by adding TypeScript and VS Code type checking support of JS files using JSDoc. This feature is optional and does not add any delays since nothing is transpiled.
This can be added in 2 ways:
- by inserting this comment at the top of .js file
- by adding the following setting to VS Code
Check this feature in action:
Here is the official documentation for JSdoc support in TypeScript.