Learn how the built-in Awaited<T> utility models the runtime await keyword. We explore how to combine the infer keyword with Recursive Type Aliases to drill down and unwrap Promises infinitely deep, and how to compose it with ReturnType for async functions.
If conditional types are the if-else statements of Type Space, the infer keyword is the variable declaration (let x = ...). Learn how to extract types dynamically via pattern matching, rebuild ReturnType, and parse Template Literal Strings at compile time.
Sometimes, you want a conditional type to evaluate an entire Union as a single monolithic entity, rather than mapping over its individual members. Learn how wrapping generic parameters in brackets [T] prevents distribution, and how to use this mechanic to build complex IsUnion checks.
When you pass a Union type into a conditional type, TypeScript doesn’t evaluate the union as a whole. It evaluates every single member of the union separately, and combines the results. Learn how this powerful (and sometimes confusing) mechanism powers TypeScript’s standard library.
Conditional types are the if-else statements of Type Space. Learn how to use the ’extends ? :’ syntax to compute dynamic types based on assignability logic, replace complex function overloads, and construct nested else-if type chains.
Take your Mapped Types to the absolute limit. Learn how to compute entirely new string names for keys on the fly using Template Literal Types, and discover how to completely filter out properties by returning never during key mapping.
The foundational guide to mastering TypeScript. Learn how the type inference engine works, master type narrowing with typeof, instanceof, in, and custom type predicates (is), build type-safe discriminated unions, and use as const assertions.
An in-depth guide to Mapped Type Modifiers in TypeScript. Learn how to preserve, add (+), or strip (-) property modifiers like readonly and ?. We explore how these mapping modifiers power TypeScript’s built-in Partial, Required, and Readonly utility types.
An in-depth guide to Mapped Types in TypeScript. Learn how to use the [K in Union] syntax to iterate over literal unions, transform existing object properties using keyof and Indexed Access, and build strict state validation maps that perfectly mirror domain models.
An in-depth guide to ReturnType<T> and Parameters<T>. Learn how to reverse-engineer third-party library functions, the requirement of typeof, tuple indexing to extract specific arguments, and the underlying infer keyword mechanics powering these utilities.