Courses Mastering TypeScript: Zero to Production Lesson 2: Setting Up Your Environment
2 of 6
33% done
const name: string = "TypeScript"
const year: number = 2025
00:00 / 22:10

Lesson 2: Setting Up Your Environment

Let’s get a TypeScript project running in under five minutes.

Install

npm install -D typescript
npx tsc --init

The tsc --init command generates a tsconfig.json — the file that controls how TypeScript checks and compiles your code.

{
  "compilerOptions": {
    "strict": true,
    "target": "ES2022",
    "module": "ESNext",
    "moduleResolution": "Bundler"
  }
}

Turning on strict from day one saves you from migrating a loose codebase later.

Run npx tsc --watch and TypeScript will re-check your files every time you save.