TypeScript doesn’t care if two types have different names; if they share the same shape, they are equivalent. Learn how to use Branding and Flavoring to force the compiler to differentiate between an OrderID string and a UserID string, powering Domain-Driven Design.
Why is it safe to return a subclass instead of a superclass, but dangerous to accept a superclass parameter instead of a subclass? Welcome to Variance: the computer science underpinning of TypeScript’s assignability engine.
An advanced masterclass in TypeScript type-level metaprogramming. Master conditional types (T extends U ? X : Y), distributive behavior, infer keyword pattern matching for unwrapping types, template literal types (${T}_${U}), and deep recursive object transformations.
Use mapped types and generics to enforce finite state transitions in the compiler. A type-level state machine makes impossible states impossible to represent, eliminating entire classes of runtime bugs.
The built-in Partial and Readonly utilities are shallow. Learn how to write your own DeepReadonly and DeepPartial utilities that penetrate every layer of nested objects by combining Generics, Conditionals, infer, Mapped Types, and Recursion simultaneously.
How do you type a JSON object? A JSON object can contain arrays of objects, which can contain arrays of objects, infinitely down. You cannot hardcode this depth. You need a Recursive Type.
TypeScript provides four built-in Intrinsic utilities that manipulate the casing of string literal types at compile time. Learn how to pair them with template literals and mapped types to dynamically generate robust event handler mappings.
Template literal types allow you to use JavaScript-style template strings (${...}) inside Type Space. Learn how to generate combinations of string literals automatically via Union Permutation, and parse delimited strings (like emails or URLs) using the infer keyword.
Pattern matching with infer isn’t just for Promises and Objects. You can deconstruct Tuples and Arrays element by element in Type Space, mirroring the exact syntax of JavaScript’s array destructuring and spread operators.
An in-depth guide to intermediate TypeScript type transformations. Master generic functions and constraints (extends), indexed access types, keyof/typeof operators, built-in helpers (Pick, Omit, Record, ReturnType), and mapped type transformations.