First type
Second type
interface A { name: string; type: 'cat'; active: true; }
interface B { name: string; type: 'dog'; active: false; }
type Result = CommonUpcastPairs<A, B>;
// { name: string; type: string; active: boolean }
// 'type': 'cat' | 'dog' → string (upcast to common base)
// 'active': true | false → boolean (upcast to common base)
// Type priority example:
type Mixed = CommonUpcastPairs<{prop: string}, {prop: 'literal'}>;
// Result: {prop: string} - chooses more general type
Finds common properties between two types with primitive literal upcasting.
Properties are included if:
stringvs'literal'), orType Selection Priority: When types can be unified, the more general type is chosen to ensure maximum compatibility (e.g.,
stringover'cat'). This maintains upcasting behavior in recursive scenarios.