AI Hints
Home›TypeScript Tutorial›Getting Started
TypeScript · Lesson 3 of 120

How It Runs

Tsc, then node.

⏱ 2 min read▶ Video at 2:07🎓 Free
Watch this lesson in the TypeScript courseWatch on YouTube ↗Full TypeScript course

Browsers and Node don't run TypeScript directly. First, the TypeScript compiler, called TSC, checks your types. Then it removes them, and writes plain JavaScript. That JavaScript is what runs.

How It Runs
From the video: How It Runs
  • Check the types
  • Remove them
  • Run the JavaScript

From TypeScript to output

You write app dot TS. TSC checks it. If the types are fine, it writes app dot JS. Node runs that file. And you see the output.

  1. app.ts
  2. tsc checks
  3. app.js
  4. node runs
  5. Output
From TypeScript to output
From the video: From TypeScript to output

Types disappear

This TypeScript has a type on the name. Run it. The compiler checked it, removed the type, and Node ran the JavaScript that was left.

app.tstypescript
const name: string = "Northwind Bikes";
console.log("Welcome to", name);
Output
Welcome to Northwind Bikes

Setting up

Install Node from nodejs dot org. Then install TypeScript with NPM. Run NPXTSC to check and compile. And use an editor like VS Code, which understands TypeScript out of the box.

keyvalue
Nodenodejs.org
TypeScriptnpm install typescript
Compilenpx tsc
EditorVS Code

Summary

TSC checks your types, removes them, and Node runs the JavaScript. Next, your first program.

Key takeaways
  • tsc checks
  • Types removed
  • node runs
Next up: Your First Program — hello, TypeScript