TypeScript
TypeScript adds static types to JavaScript. You write types, the compiler catches mistakes, your editor gives better autocomplete. Any valid JavaScript is valid TypeScript - you can adopt it incrementally.
Overview
- Language: Superset of JavaScript with static type annotations
- Runtime: Compiles to JavaScript (runs anywhere JS runs)
- Install:
npm install -D typescript(project) or use a bundler like Vite that handles it - Config:
tsconfig.jsoncontrols compiler behavior - Ecosystem: All JavaScript libraries work; most have type definitions via
@types/*
Contents
- Concepts - Type system fundamentals
- Type System - Inference, annotations, structural typing
- Types vs Interfaces - When to use which
- Generics - Reusable, type-safe code
- Quickstart - Get started
- Setup - Project setup with modern tooling
- Deep Dives - Advanced patterns
- Utility Types - Partial, Pick, Omit, and friends
- Notes - Tips and gotchas