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

What is the underlying purpose of inference priorities (e.g. a return-position candidate being lower priority than a direct-argument candidate), as in the call below where `T` is inferred as `string`?

declare function f<T>(x: T, cb: () => T): T; const r = f("hi", () => 123 as unknown as T);