@@ -5603,28 +5603,30 @@ namespace ts {
56035603 return compareTypes(getTypeOfSymbol(sourceProp), getTypeOfSymbol(targetProp));
56045604 }
56055605
5606- // A source signature matches a target signature if the two signatures have the same number of required,
5607- // optional, and rest parameters.
5608- function isMatchingSignature(source: Signature, target: Signature) {
5609- return source.parameters.length === target.parameters.length &&
5606+ function isMatchingSignature( source: Signature, target: Signature, partialMatch: boolean) {
5607+ // A source signature matches a target signature if the two signatures have the same number of required,
5608+ // optional, and rest parameters.
5609+ if ( source.parameters.length === target.parameters.length &&
56105610 source.minArgumentCount === target.minArgumentCount &&
5611- source.hasRestParameter === target.hasRestParameter;
5612- }
5613-
5614- // A source signature partially matches a target signature if the target signature has no fewer required
5615- // parameters and no more overall parameters than the source signature (where a signature with a rest
5616- // parameter is always considered to have more overall parameters than one without).
5617- function isPartiallyMatchingSignature(source: Signature, target: Signature) {
5618- return source.minArgumentCount <= target.minArgumentCount && (
5611+ source.hasRestParameter === target.hasRestParameter) {
5612+ return true;
5613+ }
5614+ // A source signature partially matches a target signature if the target signature has no fewer required
5615+ // parameters and no more overall parameters than the source signature (where a signature with a rest
5616+ // parameter is always considered to have more overall parameters than one without).
5617+ if (partialMatch && source.minArgumentCount <= target.minArgumentCount && (
56195618 source.hasRestParameter && !target.hasRestParameter ||
5620- source.hasRestParameter === target.hasRestParameter && source.parameters.length >= target.parameters.length);
5619+ source.hasRestParameter === target.hasRestParameter && source.parameters.length >= target.parameters.length)) {
5620+ return true;
5621+ }
5622+ return false;
56215623 }
56225624
56235625 function compareSignatures(source: Signature, target: Signature, partialMatch: boolean, ignoreReturnTypes: boolean, compareTypes: (s: Type, t: Type) => Ternary): Ternary {
56245626 if (source === target) {
56255627 return Ternary.True;
56265628 }
5627- if (!(isMatchingSignature(source, target) || partialMatch && isPartiallyMatchingSignature(source, target ))) {
5629+ if (!(isMatchingSignature(source, target, partialMatch ))) {
56285630 return Ternary.False;
56295631 }
56305632 let result = Ternary.True;
0 commit comments