yarn
yarn test
yarn test --watchAll
ctrl-shift-b (or on mac, cmd-shift-b)
Call the function you want to debug from src/main.ts
Add a breakpoint in your function by clicking to the left of the relevant line number.
Open the "run and debug" panel
From the top choose "Debug main.ts"
That's it, the debugger should launch and pause when your first breakpoint is encountered.
This will compile your code before running, and will show you the typescript source even though in reality the debugger is stepping through the relevant compiled javascript. It is able to do this because tsconfig specifies sourceMap: true
and an ourDir
location.
If you're curious you can see the specific details in ./vscode/launch.json
Some codewars katas support typescript. Others only support JS submissions.
Here's how to compile one stand-alone .ts file into .js for the latter type of kata.
You will first need to alter make-js-for-one
in package.json to refer to the file you want compiled.
then:
yarn make-js-for-one
your output .js will be generated into a new folder generatedJS
.
You don't need to use the make-js-for-one convenience command. Instead:
yarn tsc src/myGreatFile.ts --outDir generatedJS
but you might get tired of typing that!
This is part of Academy's technical curriculum for The Mark. All parts of that curriculum, including this project, are licensed under a Creative Commons Attribution-NonCommercial-NoDerivatives 4.0 International License