TypeScript guides
Every published TypeScript guide, newest first, with practical examples you can copy into your own project.
3,815 guides across 14 topics
Topics
Popular TypeScript guides
Most readTypeScript Generic Parameter Defaults: Syntax, Precedence, and Inference
TypeScript Branded Types: Nominal Typing, Type Tags, and Validation
TypeScript Ambient Declarations: .d.ts Files, declare, and declare global
TypeScript Discriminated Unions: Exhaustiveness Checking and the never Type
Latest TypeScript guides
Page 1 of 2TypeScript Branded Types: Nominal Typing, Type Tags, and Validation
How a phantom property makes two strings incompatible, unique symbol brands, unit-typed numbers, and the places where a brand quietly disappears.
TypeScript Generic Parameter Defaults: Syntax, Precedence, and Inference
When a default applies and when inference wins, defaults that reference earlier parameters, and how a defaulted type parameter keeps a library change non-breaking.
TypeScript Ambient Declarations: .d.ts Files, declare, and declare global
How declare and .d.ts files describe runtime values, wildcard modules for assets, declare global with var, and module augmentation of third-party types.
TypeScript Namespaces vs Modules: Syntax, Declaration Merging, and Use Cases
How namespace merging works across files, why isolatedModules rejects it, and a migration path to ES modules with barrels and export * as.
TypeScript Type Assertions: as Syntax, Non-Null Assertion, and Safety
What an assertion actually promises, when the compiler rejects one, how as unknown as T bypasses the check, and where ! hides a lifecycle bug.
TypeScript Indexed Access Types: Syntax, Lookup Types, and Arrays
T[K] lookups on objects, arrays, and tuples, the undefined that optional properties add, and recursive path types built on indexed access.
TypeScript Function Overloads: Syntax, Signatures, and Implementation
Overload resolution order, why the implementation signature is invisible to callers, the union-argument rejection, and when a generic signature is shorter.
TypeScript Discriminated Unions: Exhaustiveness Checking and the never Type
Why the discriminant must be a literal, how never closes an exhaustive switch, and the duplicate-discriminant bug that lets a missing case compile.
TypeScript Enums: Numeric, String, const Enums, and Alternatives
How each enum form compiles, why numeric enums emit a reverse mapping, what const enums cost under per-file transpilation, and how an as const object replaces them.
TypeScript Mapped Types: Syntax, Key Remapping with as, and Modifiers
How mapped types iterate over keys, add and remove readonly and optional modifiers, and use the as clause to rename keys or drop properties entirely with never.