DEV Community

Henry Williams
Henry Williams

Posted on • Edited on

2

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)

Hostinger image

Get n8n VPS hosting 3x cheaper than a cloud solution

Get fast, easy, secure n8n VPS hosting from $4.99/mo at Hostinger. Automate any workflow using a pre-installed n8n application and no-code customization.

Start now

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay