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.