A method intersection forms a callable method type by intersecting same-named method signatures from constituent types. Its behavior resembles overloads, but the resulting type can be difficult to implement. section 10.3.2
Person and Employee contact methods
Person defines getContact(field: string): string, while Employee defines getContact(field: number): number. Their intersection exposes both call signatures. An implementation accepting string | number can return the matching contact value. section 10.3.2
Inspect the compiler’s result and account for these behaviors:
- Use the generated declaration file to verify how the compiler merged the signatures. section 10.3.2
