Method Overload Intersections
You'll learn: How intersecting types with methods creates complex overload sets and potential ambiguity.
What's the Problem?
When you intersect two types that each define the same method name but with different overload signatures, TypeScript merges all the overloads from both types into a single combined overload set. This can create surprisingly complex (and sometimes confusing) function signatures.
How Method Overloads Combine
With function intersections, you've already seen how multiple call signatures merge. The exact same principle applies to methods inside object types:
type WithName = {
format(value: string): string;
};
type WithAge = {
format(value: number): string;
};
type Combined = WithName & WithAge;
// Combined has format with BOTH overloads:
// format(value: string): string;
// format(value: number): string;
The format method now accepts either a string OR a number — TypeScript merged the overload signatures from both types.
The Ambiguity Problem
Things get tricky when overload signatures conflict or when implementation becomes unclear:
type A = {
process(x: string): number;
};
type B = {
process(x: string): boolean;
};
type Conflict = A & B;
// What does process(x: string) return?
// Both number AND boolean (impossible!)
// TypeScript creates: never
When the same parameter types map to different return types, the intersection creates an impossible constraint. The return type becomes never because no value can be both number and boolean simultaneously.
Key Takeaway: Intersecting types with method overloads merges all signatures into one overload set, but conflicting signatures for identical parameters create impossible never types that make the method uncallable.