Skip to main content
Journey Uncommon Logo
JourneyUncommon
hardTypeScriptrecursive depth limitsSingle-choice MCQ

TypeScript optimizes tail-recursive conditional types (where the recursive call is the entire result of a branch) so they don't grow the instantiation stack. Even so, what happens at TypeScript 5.x for the call below?

type BuildTuple<N extends number, Acc extends unknown[] = []> = Acc['length'] extends N ? Acc : BuildTuple<N, [...Acc, unknown]>; type T = BuildTuple<1000>;