Created
June 24, 2021 13:27
-
-
Save fedek6/29e1992be5233c3ce8466526c046e63c to your computer and use it in GitHub Desktop.
Working TypeScript debug example for Visual Studio Code
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// src/index.ts | |
import { lubiePlacki } from "./placki"; | |
function printMessage(msg: string): void { | |
console.log(`Message: ${msg}`); | |
} | |
printMessage("Hello, TypeScript"); | |
debugger; | |
lubiePlacki(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// .vscode/launch.json | |
{ | |
// Use IntelliSense to learn about possible attributes. | |
// Hover to view descriptions of existing attributes. | |
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 | |
"version": "0.2.0", | |
"configurations": [ | |
{ | |
"type": "node", | |
"request": "launch", | |
"name": "Launch Program", | |
"preLaunchTask": "npm: build", | |
"skipFiles": [ | |
"<node_internals>/**" | |
], | |
"program": "${workspaceFolder}/dist/index.js" | |
} | |
] | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"name": "typescript-fun", | |
"version": "1.0.0", | |
"description": "", | |
"main": "index.js", | |
"scripts": { | |
"start": "tsc-watch --onSuccess \"node ./dist/index.js\"", | |
"build": "tsc", | |
"list": "tsc --listFiles", | |
"test": "echo \"Error: no test specified\" && exit 1" | |
}, | |
"keywords": [], | |
"author": "", | |
"license": "ISC", | |
"devDependencies": { | |
"tsc-watch": "^2.1.2", | |
"typescript": "^3.5.1" | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// src/placki.ts | |
export const lubiePlacki = () => { | |
console.log("Lubie placki"); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Show hidden characters
{ | |
"compilerOptions": { | |
"target": "es2018", | |
"outDir": "dist", | |
"rootDir": "src", | |
"module": "commonjs", | |
"sourceMap": true | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment