Programming Languages
Types that catch bugs before your users do — from annotations to generics.
Start with the compiler and everyday types, learn how narrowing really works, then build reusable types with generics and type manipulation. Classes are an optional detour.
What TypeScript adds to JavaScript, how to run the compiler, and why strict should be on from day one.
Install the compiler and type-check a file.
The options that matter, and the one that matters most.
Annotate the edges; let inference handle the middle.
Primitives, arrays, objects and unions — the types you will write every single day.
Why unknown is the safe any.
Lists of one type, and fixed-length rows of several.
Optional and readonly properties, index signatures.
"a" | "b" beats string whenever the set is known.
Typing parameters and returns, optional arguments, overloads and this.
Describe a callback's shape once and reuse it.
?, defaults and rest parameters.
Several call signatures for one function — and when a union is simpler.
How TypeScript follows your ifs to know what a value is at each line.
The built-in guards.
A shared kind field makes impossible states unrepresentable.
value is T predicates for your own checks.
Two ways to name a shape, and how to combine them.
Named object shapes that can be extended and merged.
A name for any type — unions included.
extends and & to build bigger types from small ones.
Write a function or type once and let the caller choose the types.
<T> parameters inferred from arguments.
T extends … to require what the body needs.
Generic interfaces, aliases and classes.
Build types from other types instead of writing them twice.
Turn values and objects into types.
T[K] and { [K in keyof T]: … }.
Partial, Pick, Omit, Record and the rest of the toolbox.
T extends U ? X : Y and infer.
Optional for most frontend work: classes, access modifiers and implementing interfaces.
Fields, constructors, methods, getters.
public, private, protected — and #private fields.