I am learning typescript with visual studio code in Windows 10 and I am getting an error to run simple program.
"Cannot launch program 'E:\typescriptBasis\main.ts' because corresponding JavaScript cannot be found." hence I am not able to debug code.
I have installed nodejs version v10.2.1
I have installed npm version v5.6.0
I have installed typescript globally v2.8.3
I have installed Visual sudio code v1.23.1
launch.json file
"version": "0.2.0",
"configurations": [
{
"type": "node",
"request": "launch",
"sourceMaps": true,
"name": "Launch Program",
"program": "${workspaceFolder}/main.ts",
"outFiles": [
"${workspaceFolder}/**/*.js"
]
}
]
}
tsconfig.json file
{
"compilerOptions": {
"target": "es5",
"module": "commonjs",
"sourceMap": true
}
}
tasks.json
{
"version": "2.0.0",
"tasks": [
{
"type": "typescript",
"tsconfig": ".vscode\\tsconfig.json",
"option": "watch",
"problemMatcher": [
"$tsc-watch"
]
},
{
"type": "typescript",
"tsconfig": ".vscode\\tsconfig.json",
"problemMatcher": [
"$tsc"
],
"group": {
"kind": "build",
"isDefault": true
}
}
]
}
main.ts file
console.log("this is my first program of typescript");
tscin the terminal to generate a .js filenode main.jsor in a browser?<script src='main.js'>tscin the terminal or pressing cmd+shift+b