An exhaustive guide to the keyof operator in TypeScript. Learn how keyof extracts property key unions from object interfaces, array/tuple types, index signatures, and how to combine keyof with Generics to build type-safe property accessors.
An in-depth guide to Indexed Access Types (T[K]). Learn how to look up specific property types from object shapes, perform nested indexing, index with unions T['a' | 'b'], extract array element types using [number], and enforce DRY type architectures.
An exhaustive comparison of interface vs type in TypeScript. Understand Declaration Merging, extends vs Intersections (&), compiler performance during type checking, and the precise decision matrix for choosing between them.
An exhaustive analysis of Const Assertions (as const). Learn the 3 transformation rules of const assertions, deep recursive read-only object properties, converting arrays into readonly tuples, and deriving union types dynamically using typeof ARRAY[number].
An exhaustive deep dive into TypeScript’s bottom type (never). Learn how set theory models the empty set ($mptyset$), the 3 sources of ’never’ in type analysis, and how to implement compile-time exhaustiveness checking for Discriminated Unions.
An in-depth guide to Function Overloads in TypeScript. Learn how to define multiple overload signatures, why the implementation signature is invisible to callers, how TypeScript matches overloads sequentially, and when to use Union types instead of Overloads.
An exhaustive guide to typing functions in TypeScript. Learn function expressions, type aliases, destructuring parameter signatures, optional/default/rest parameters, call signatures with properties, and why ‘void’ callbacks ignore return values.
An exhaustive guide to Discriminated Unions in TypeScript. Learn why optional property blobs create impossible states, the 3 requirements for tagged unions, how Control Flow Analysis narrows discriminants, and real-world domain state patterns.
Learn how to build custom runtime type validators in TypeScript. Master Type Predicates (parameter is Type), Assertion Functions (asserts val is Type), array .filter() type narrowing, and safely parsing untrusted external JSON data.
Understand how TypeScript’s Control Flow Analysis engine refines types across code branches. Master typeof guards (and the typeof null quirk), instanceof class narrowing, the ‘in’ property operator, equality narrowing, and truthiness pitfalls.