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 2 of 2TypeScript unknown vs any: Type Safety, Type Guards, and Best Practices
Why any contaminates every caller while unknown forces the check at the boundary, with validation functions, generic inference traps, and the few places any is honestly correct.
TypeScript keyof and typeof: Object Type Queries and Property Keys
The difference between the two type queries, why keyof typeof collapses to string without literal types, and how K extends keyof T keeps a key and its value type in correspondence.
TypeScript infer Keyword: Conditional Types, ReturnType, and Unwrapping
How infer binds a type inside a conditional type, why distribution over unions changes results, and how ReturnType, Parameters, and recursive unwrapping types are actually built.
TypeScript as const: Const Assertions, Readonly Tuples, and Literal Types
What as const actually changes in inference, why object properties widen without it, and how readonly tuples, derived unions, and satisfies combine in real config and route tables.
TypeScript Decorators: Stage 3 Syntax, Method Decorators, and Metadata
The standard decorator pipeline since TypeScript 5.0: the value and context signature for methods, fields, and accessors, addInitializer ordering, Symbol.metadata, and where it diverges from experimentalDecorators.
TypeScript Template Literal Types: Syntax, String Manipulation, and Patterns
Template literal types as patterns over string types: union cross products, the four intrinsic case types, key remapping with as, infer-based splitting, and the depth limit that ends recursive types.
TypeScript Generics: Type Constraints, extends Keyof, and Default Types
What T extends really constrains, how K extends keyof T keeps a return type tied to the key you pass, defaults on type parameters, and where NoInfer stops a second argument from widening inference.
TypeScript Type Narrowing: Type Guards, in Operator, and Discriminated Unions
Every guard TypeScript uses to narrow a union, what each one removes, and the three failures that keep narrowing from applying: typeof null, widened discriminants, and closures over mutable bindings.
TypeScript Utility Types: Pick, Omit, Partial, and Record Explained
How Pick, Omit, Partial, and Record are built from mapped types: what each preserves, why Omit accepts a typo, how Partial distributes over unions, and the errors each raises.
TypeScript satisfies Operator: Syntax, vs Type Annotations, and as const
How the TypeScript 4.9 satisfies operator validates an expression without widening its inferred type, why per-property types survive, and how as const changes the result.