Create a TypeScript Project in Visual Studio Code with debug in less than 3 minutes.

preview_player
Показать описание
How to create a new node typescript project with debug using Visual Studio Code.

Open a terminal
⟩mkdir tswithdebug
⟩cd tswithdebug

Note: -y means say yes to everything
⟩npm init -y

Install typescript in project
⟩npm install --save-dev typescript

Install typescript app
⟩sudo apt install node-typescript

⟩tsc --init

“target”: “ES2020”
“sourceMap”: true
“outDir”: “./lib”

Make Main class:

class Main {

private name: string = "";

constructor() {
}

}

let NewMain: Main = new Main();

export { NewMain as Main };

Open "Run and Debug" from the left hand nav: |⟩

{
"type": "pwa-node",
"request": "launch",
"name": "Launch Program",
"skipFiles": [
"⟨node_internals⟩/**"
],
"outFiles": [
"${workspaceFolder}/lib/**/*.js" // CHANGE "${workspaceFolder}/**/*.js"
]
}

Рекомендации по теме
Комментарии
Автор

Thank you! This finally worked for me! Keep the good work.

ankitrajput
visit shbcf.ru