Learn TypeScript by doing. Every topic is a piece of code you can run — work down through types, narrowing, interfaces, classes, generics, and the advanced type machinery you'll meet in a Next.js codebase. No setup needed: create-next-app installs and configures TypeScript for you.
Be comfortable with JavaScript first — this course assumes it.
Before you start
If you want to practice the exercises in this course on your computer:
Ctrl+`).pnpm create next-app@latest my-app --yes if you are using pnpm, or npx create-next-app@latest my-app --yes if you are using npm. This creates a my-app folder containing a Next.js project with TypeScript already configured.my-app folder (File → Open Folder) and run pnpm dev (or npm run dev) in the terminal.app/page.tsx — VS Code underlines type errors as you type, and with the dev server running, http://localhost:3000 updates every time you save the file.Everyday Types
Master the types you use daily — primitives and inference, arrays, tuples, objects with optional and readonly properties, enums, and any, unknown, void, never.
Type Assertions
Override the compiler when you know more than it does — as Type, the non-null assertion, as const for literal types, and satisfies for validation without widening.
Combining Types
Build bigger types from smaller ones — type aliases, union types, intersection types, and the keyof operator for type-safe property access.
Type Guards & Narrowing
Work with unions safely — typeof, truthiness, and equality narrowing, discriminated unions, instanceof and in, plus custom type predicates for unknown data.
Interfaces
Describe object shapes with interfaces — declaring them, extending them, and implementing them in classes.
Typing Functions
Type parameters and returns, optional, default, and rest parameters, describe callbacks with function types, and write overloads for multiple call shapes.
Classes
TypeScript classes in practice — parameter properties, access modifiers, inheritance with checked override, and abstract classes.
Generics
Write logic once with full type safety — generic functions, type aliases, and classes, plus constraints with extends and keyof for type-safe utilities.
Utility Types
Transform types with the built-ins — Partial, Readonly, Pick, Omit, Record, Exclude, Extract, NonNullable, Parameters, ReturnType, Awaited, and InstanceType.
Advanced Types
The type-level toolkit — literal and template literal types, mapped types with key remapping, conditional types with infer, and recursive types for JSON and trees.
Modules
Split code across files — named, default, and namespace imports and exports, plus type-only imports that disappear from the compiled output.