This lesson has been retired.

Video Processing Status: completed

No video source files were found yet. Check back in an hour. If there's still a problem let us know.

Save 45% for a limited time.

Get access to all courses and lessons on egghead today.

Autoplay

    Stopping a TypeScript Build When Errors Are Found

    John LindquistJohn Lindquist

    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.

    typescriptTypeScript
    Code

    Code

    Become a Member to view code

    You must be a Member to view code

    Access all courses and lessons, track your progress, gain confidence and expertise.

    Become a Member
    and unlock code for this lesson
    Transcript

    Transcript

    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.

    Discuss

    Discuss