Lesson 1 of 56 · Typescript
Course Overview & Environment Setup
Duration: 15 minutes
Welcome to TypeScript!
In this first lesson we’ll install Node.js (v20+), npm, and the TypeScript compiler (tsc).
Install Node.js
# macOS / Linux (using Homebrew)
brew install node
# Windows (via Chocolatey)
choco install nodejs
Install TypeScript globally
npm install -g typescript
Verify installation
$ node -v
$ npm -v
$ tsc -v # should print something like 5.2.x
Create a new project folder and initialize npm:
mkdir ts‑mastery && cd $_
npm init -y
Now add a tsconfig.json – this file tells the compiler how to emit JavaScript:
{
"compilerOptions": {
"target": "ES2022",
"module": "ESNext",
"strict": true,
"outDir": "dist",
"rootDir": "src",
"esModuleInterop": true,
"skipLibCheck": true
}
}
Create a src folder with a simple index.ts:
// src/index.ts
console.log('👋 Hello, TypeScript!');
Compile and run:
npx tsc # compiles to ./dist/index.js
node dist/index.js
Tip: Use
npx ts-node src/index.tsfor rapid prototyping without a build step.