Typescrip debugging

Hi,

Is there a way to debug typescript without using the built in compiler?

I have a nodeamon which compiles my application and push the js files to dist directory (while my ts files are in src directory).

Please note that the compiler produces source-map files.

 

0
5 comments

Sure you don't necessary need to use built-in compiler - any tool that produces proper sourcemaps will work. What tool do you use to transpile your .ts files? Nodemon (https://github.com/remy/nodemon/) itself doesn't compile anything - it just watches files for changes and restarts the process

0
Avatar
Permanently deleted user

I use Nodemon to restart my server after I change the code. I am transpiling/compiling the code with plain tsc (which is installed globally). 

0

using TSC installed globally is more or less the same as using built-in compiler: produced sourcemaps shouldn't differ. And I'm not aware of any problems debugging ts code transpiled with tsc

0
Avatar
Permanently deleted user

Are there any documents on how to do it? 

in this documentation there are some unclear points (https://www.jetbrains.com/help/idea/2016.3/debugging-typescript.html):

1. You already answered 

2.  "In the editor, open the HTML files with the TypeScript references." - I do not have any html file as it is a node application.

3. Not sure what should I do in this step...

 

0

No hints for Node.js, as no special steps are required: In Node.js Run configuration, you need to specify a path to your main .js file (https://confluence.jetbrains.com/display/WI/Running+and+debugging+Node.js+application#RunninganddebuggingNode.jsapplication-DebuggingNode.jsapplocally). If this file has //# sourceMappingURL comment pointing to source map, debugger will resolve original .ts file from this map and breakpoints in this .ts file will work. That's all

0

Please sign in to leave a comment.