This lesson is for PRO members.

Unlock this lesson NOW!
Already subscribed? sign in

Compiling TypeScript with WebStorm

1:31 TypeScript lesson by

As long as you have a properly configured .tsconfig, most tooling can just run tsc behind the scenes to build your project. This lesson shows how WebStorm includes a nice interface for reporting and navigating to the errors and will continuously run your TypeScript build for you.


egghead.io comment guidelines

Avatar
egghead.io

As long as you have a properly configured .tsconfig, most tooling can just run tsc behind the scenes to build your project. This lesson shows how WebStorm includes a nice interface for reporting and navigating to the errors and will continuously run your TypeScript build for you.

Avatar
Sequoia McDowell

Wish you'd do a basic VS Code setup/watch intro as well! It's free so easier to dip a toe in. Webstorm is great too of course. :)

While you can use any editor that you'd like with TypeScript, I'm going to use WebStorm because it's my personal preferred editor. If I open the same directory, it's going to prompt me to compile TypeScript to JavaScript.

Now, if you already have a tsconfig, and you click OK, it's going to find that tsconfig, use those settings, and then start running tsc every time those files change. It's basically like doing a tsc-w watch for you.

The neat thing, though, is if I make mistake here, and it pops up an error, it will output the errors here, and I can double-click and jump to them. You see if I double-click here, it jumps to that space. If I double-click here, it jumps to here.

If you want to see the actual console output, you can see it through here that it's just running tsc and then outputting as expected. Now, if you want to change any of these settings, go into Settings, then navigate down to Languages and Frameworks and select TypeScript.

You can see the different settings like should I resolve using the tsconfig? Should I enable the compiler so you can turn that off if you turned it on? You can set options manually using the command line, and have complete control over those settings.

The most important thing to remember here is that, if you have a tsconfig, it doesn't matter whether you're compiling WebStorm, or whether you're compiling from the command line, or however you're doing it. As long as it's invoking tsc and it's using the tsconfig, it's always going to output the exact same files in the exact same directory.

HEY, QUICK QUESTION!
Joel's Head
Why are we asking?