TypeScript Up and Running in Seconds

Robert Penner
InstructorRobert Penner
Share this video with your friends

Social Share Links

Send Tweet

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

[00:00] 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.

[00:17] 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.

[00:32] 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.