⚠️ This lesson is retired and might contain outdated information.

Stopping a TypeScript Build When Errors Are Found

John Lindquist
InstructorJohn Lindquist
Share this video with your friends

Social Share Links

Send Tweet

TypeScript will always compile even if there are ridiculous errors in your project. This lesson shows how to configure your .tsconfig with "noEmitOnError" so that no files are output if tsc reports an error.

[00:00] When your code has errors in it, I'll just type some obvious errors, your IDE, your tooling, will probably tell you what's going on and that there's errors, there. If I come in here and I run TSC, you'll see it prints out all of these errors, lets you know that all that stuff happened, but it still actually compiles all of this.

[00:21] If you don't want it to compile when an error happens, you have to define "No emit on error" to "True." This way, when you have an error in your main file, and I'm going to delete my dist directory to show that that this is not compiling now, when I run TSC, you'll see it shows all those errors. It also did not create that dist file with the compiled files.

[00:48] If you set this to "Faults," I'll hit "Save," run TSC, you'll see this time, it does create the dist with the weird, crazy errors that I made.