⚠️ 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
Published 8 years ago
Updated 5 years ago

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.

egghead
egghead
~ 10 minutes ago

Member comments are a way for members to communicate, interact, and ask questions about a lesson.

The instructor or someone from the community might respond to your question Here are a few basic guidelines to commenting on egghead.io

Be on-Topic

Comments are for discussing a lesson. If you're having a general issue with the website functionality, please contact us at support@egghead.io.

Avoid meta-discussion

  • This was great!
  • This was horrible!
  • I didn't like this because it didn't match my skill level.
  • +1 It will likely be deleted as spam.

Code Problems?

Should be accompanied by code! Codesandbox or Stackblitz provide a way to share code and discuss it in context

Details and Context

Vague question? Vague answer. Any details and context you can provide will lure more interesting answers!

Markdown supported.
Become a member to join the discussionEnroll Today