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.
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.
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.
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.