TypeScript 44 🔷 Distributive Conditional Types
A conditional type in TypeScript has the shape T extends U ? X : Y — if T is assignable to U, the type resolves to X, otherwise to Y. That much is straightforward. The subtlety is what happens when T is a union. TypeScript does not evaluate the conditional once against the whole union….