Skip to main content
Journey Uncommon Logo
JourneyUncommon
hardTypeScriptvariadic tuple typesSingle-choice MCQ

Why does the second overload-like inference below fail to produce the 'concatenated' tuple a developer expects, collapsing instead to a less precise type?

declare function concat<T extends readonly unknown[], U extends readonly unknown[]>( a: T, b: U ): [...T, ...U]; const r = concat([1, 2], ["a", "b"]); // ^? without `as const`, what is r's element-level type?