TypeScript topic hubs
Each hub explains one family of TypeScript features: the problem they solve, the version that introduced each one, a sample compiled with TypeScript 7.0.2 for every feature, the compiler errors you will meet, the pitfalls, and how to choose between related features. Together the hubs cover every TypeScript feature on this site. If you are new to TypeScript, work through the four TypeScript basics tutorials first; the hubs assume you can already type variables, functions, objects and classes.
TypeScript features that are really JavaScript features, such as classes, async functions, modules, optional chaining and spread, are explained once in the JavaScript section. The hubs link there and cover only what TypeScript adds.
Learning path
Section titled βLearning pathβRead the hubs in this order. The first three are about everyday type modeling; the later ones build on them or matter mainly in libraries, large codebases and project setup.
- Core type system: interfaces, union and intersection types, tuples, index signatures and
as const: the building blocks for describing data. - Type narrowing:
strictNullChecks, type guards, discriminated unions with exhaustiveness checks, and whenas,!andsatisfiesare safe. - Generics and functions: generic functions and classes, constraints and defaults, overloads, and typing async code.
- Classes and decorators: what TypeScript adds to JavaScript classes: access modifiers, abstract classes,
override,thisparameters and standard decorators. - Advanced types: deriving types from types with
keyof,typeof, indexed access, conditional types, mapped types and template literal types. - Utility types: the built-in helpers such as
Partial,Omit,Record,Exclude,NonNullableandReturnType, with their definitions. - Declarations and modules:
.d.tsfiles and@types, declaration merging, module augmentation and namespaces. - Tooling and project structure: strict options, module settings, type stripping, project references and the move to TypeScript 7.
Where to go next
Section titled βWhere to go nextβ- TypeScript features by topic: every feature in one table, with the version that introduced it and a link to its section.
- TypeScript versions: what each release added, through TypeScript 7.
- TypeScript interview questions: questions that cut across the hubs; each hub also ends with its own.