Automatically transpile TypeScript file before Run/Debug

I have server-side .ts files that I want to run and debug. I've followed the Running and debugging a server-side TypeScript application with Node.js guide, but was somewhat surprised to see that the file was not automatically transpiled after I modified it and executed its Run configuration.

Every time I make a change in the .ts source, do I have to hunt for the tiny green hammer button to Compile your TypeScript code into JavaScript?

How can that be automated? Do I need to set up a watcher? Use ts-node? Something else? What I ended up doing was add a "Before launch" "Compile TypeScript" step in the Run/Debug config with "Check errors" checked, but if there's an error in an unrelated file in the project, that doesn't compile the file I want to execute.

This is a pretty basic requirement and the recommended solution should be explained in that guide I linked above. Thanks!

Comment actions Permalink

>How can that be automated? Do I need to set up a watcher?

No, you can just enable the Recompile on changes in Settings | Languages & Frameworks | TypeScript; see

Comment actions Permalink

Thank you, the recompile option is the easiest and most transparent.

Shouldn't it be mentioned at ?


Please sign in to leave a comment.