Skip to main content
Journey Uncommon Logo
JourneyUncommon
hardTypeScriptcompiler-performance blowupsSingle-choice MCQ

Why can a deeply nested conditional type over a large union cause TypeScript's checker time to blow up super-linearly, and what internal behavior drives it?

type Expand<T> = T extends infer U ? U extends [infer Head, ...infer Tail] ? [Head, ...Expand<Tail>] : [] : never; type R = Expand<[/* hundreds of elements */]>;