Now this post is not intended to persuade you to begin type checking your JavaScript. Rather if you’re interested in type checking but don’t want to transform your code to typescript yet, this article will inform you how to do it.
A key benefit of this approach is that you can add type checking gradually, per file.
Install typescript
npm install -g typescript
tsc filename.js …
In case you are trying to use parcel bundler or any code transformer using the Visual Studio Code (vscode) Chrome Debugger and get
Breakpoint ignored because generated code not found (source map problem?).
You’ll have to make sure that your generated source map points to the correct file paths.
In your launch.js
webRoot
to specify your source foldersourceMapPathOverrides
.vscode/launch.js
More info on sourceMapPathOverrides
Breakpoints may still not trigger on initial load. When you start the debugger which launches Chrome, there is a lag before vscode can attach to Chrome…