DEV Community

Henry Williams
Henry Williams

Posted on • Updated on

Get more type help from VS Code

Intro

This is a very short tutorial for getting more help on potential Javascript typing errors.

Type linting

VS Code offers great type inference. However, one of the most powerful feature for JS type linting is disabled by default.

Linting disabled (default)

Linting disabled example

Linting enabled

Linting enabled example

Enabling linting

Enabling this type check is surprisingly each. All you have to do is go to your User Settings and enable javascript.implicitProjectConfig.checkJs.
Alt Text

That's it! You've taken a step towards improving your workflow by catching potential type errors.

More on using types

When writing Javascript, I highly recommend using JSDoc annotations for most of your code for the best type inference experience. With JSDoc, VS Code will be able to provide much better type autocompletion, which makes it easier for you and others to understand and maintain your code.
Check out my other article on Javascript typings if you'd like to learn more about this.

Top comments (0)