How do I navigate to original TypeScript file from JavaScript stacktrace in WebStorm with Node?
debugging, javascript, node.js, typescript, webstorm
Solution
I get stack traces using the TypeScript source file line numbers by requiring module `source-map-support/register`. This can be done a number of ways, e,.g. on the node command line with `--require source-map-support/register`, or you can require it in your main program. For unit testing, I have it in my `mocha.opts` file:
--require source-map-support/register
--recursive
Another approach is using the `ts-node` package
Problem
I'm new to TypeScript. On a Mac I'm using WebStorm 2016.2.4 for Node with TypeScript 2.0. Interactive debugging works fine using generated maps, but runtime stack trace links point to JavaScript files, not original TypeScript files. Is this normal and expected? Is there a WebStorm feature I'm missing that can translate those links to the original TypeScript file and line or is this just something TypeScript developers must suffer with?