Skip to content

Latest commit

 

History

History
27 lines (21 loc) · 1.79 KB

How to debug TypeScript in VS Code.md

File metadata and controls

27 lines (21 loc) · 1.79 KB

This doc shows how to debug TypeScript in Visual Studio Code

Step 1: Download and Install NodeJS
Step 2: Create a folder and open this folder by Visual Studio Code
Step 3: Open Terminal and Install typescript
image
Step 4: Run npm init to create package.json, just press enter to use default value
image
Step 5: Run tsc --init to tsconfig.json, and make sure sourceMap is true, and also specify an outDir to store the js file. image
Step 6. create launch.json

 "preLaunchTask": "tsc: build - tsconfig.json",

image
Step 7. Create src folder, and then create a TS file in it, image
Step 8: Click Run->Start debugging. see the breakpoint is already hit: image
Step 9: You also can cd to the output folder where JS is in, and then run this command: node *.js file, see the breakpoint is also hit, and the console.log is working as well
image