Skip to main content
Journey Uncommon Logo
JourneyUncommon
hardTypeScriptinference internalsSingle-choice MCQ

TypeScript performs inference in two passes with respect to inference priority. Why does the following infer `T` as `string` rather than `string | number`?

declare function f<T>( a: T, b: T extends string ? T : never ): T; const r = f("x" as string, "y");