Learn TypeScript – all lessons
15 lessons from beginner to advanced, building on each other and with code examples.
Hello TypeScript & Compiling
Your first program and what the compiler does.
Basic Types & Type Inference
string, number, boolean, arrays, tuples, any and unknown.
Typing Functions
Parameters, return types, optional arguments and function types.
Objects, Interfaces & Type Aliases
Describing the shape of objects – optional, read-only and extensible.
Union & Literal Types
Restricting values to several types or fixed values.
Narrowing, Type Guards & Discriminated Unions
Narrowing types in code and letting the compiler check all cases.
Generics
Reusable functions and classes that work with many types.
Classes in TypeScript
Access modifiers, parameter properties, abstract and implements.
Utility Types
Partial, Pick, Omit, Record & co. – deriving types from types.
Strict Mode & Null Safety
Why strict: true is a must and how to handle null and unknown safely.
Modules, Type Declarations & tsconfig
import type, @types packages, .d.ts files and important compiler options.
keyof, typeof & Mapped Types
Computing types from values and from other types.
Conditional Types, infer & Template Literals
Types with "if-then" logic and strings at the type level.
Advanced Patterns: satisfies, Brands & Overloads
Proven techniques for safe and expressive APIs.
Async, APIs & Runtime Validation
Promise<T>, typed fetch functions and why types do not check data.