Search code examples
node.jstypescriptintellij-ideawebstorm

How can I launch node to run a .ts file from IntelliJ?


I have a project set up with IntelliJ IDEA happily compiling .ts TypeScript files to .js ES6 files. The .js files are being dumped neatly next to the .ts files.

directory tree

I'd like to the able to run the .ts files in node.js just like I can with the .js files. E.g. using Cmd + Shift + F10 on <file>.ts IntelliJ will launch node <file>.js (after running the TypeScript compiler).

After each file edit it feels awkward having to remember to open the .js version before running the file I just edited.

The equivalent experience for a Java programmer would be navigating to the .class version of a unit test to execute the edited .java file.

Is this just a missing feature in IntelliJ/WebStorm or am I missing something?


Solution

  • There is no such feature, as there is no generic way to find the generated file from original one - there are dozens (actually - unlimited) ways to transform them. You can resolve original file from generated one using sourcemaps, but not vice versa. Anyway, please vote for WEB-25389