Become a member
to unlock all features

Level Up!

Access all courses & lessons on egghead today and lock-in your price for life.


    TypeScript Up and Running in Seconds


    It’s easy to get up and running with TypeScript, a strongly-typed superset of JavaScript. We’ll cover:

    • installing the compiler with Node.js
    • compiling TypeScript to JavaScript
    • auto-watching source files for changes
    • fixing code errors found by TypeScript


    Become a Member to view code

    You must be a Pro 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
    orLog In




    We can have a TypeScript workflow up and running in seconds, using only Node and a text editor. First, we'll install the TypeScript compiler globally with Node's package manager. Let's create a simple TypeScript file and pass it to tsc, the TypeScript compiler.

    This generates a JavaScript file, which we can run in Node and see that it's working. Let's view our ts and js files side by side. We can ask the TypeScript compiler to watch all ts files for changes.

    Now, when we edit the TypeScript file, it's compiled to JavaScript automatically on save. If our TypeScript is incorrect, the compiler shows an error message with the line number. We are missing a new in line two. Let's fix it. Save. We're good to go.