How do we debug typescript?
You need to tell the typescript compiler to keep the source map files. By passing the
--sourceMap option when
initializing the project or by adding the
"sourceMap": true configuration to the
With a modern chrome browser you can then easily debug your code in typescript it self. The source
.ts files are
loaded into the debugger.
For example once I run a small Angular 2 app written in typescript, all I have to do is simply start the developer console. The source files will be automatically loaded.
If you take a look at the generated source mapping files, you will see that it stores the location of the source file.
Thus allowing a compatible browser like chrome to load the typescript files to debug.