File tree Expand file tree Collapse file tree 1 file changed +9
-5
lines changed
Expand file tree Collapse file tree 1 file changed +9
-5
lines changed Original file line number Diff line number Diff line change @@ -25056,12 +25056,16 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker {
2505625056
2505725057 function inferFromSignatures(source: Type, target: Type, kind: SignatureKind) {
2505825058 const sourceSignatures = getSignaturesOfType(source, kind);
25059- const targetSignatures = getSignaturesOfType(target, kind);
2506025059 const sourceLen = sourceSignatures.length;
25061- const targetLen = targetSignatures.length;
25062- const len = sourceLen < targetLen ? sourceLen : targetLen;
25063- for (let i = 0; i < len; i++) {
25064- inferFromSignature(getBaseSignature(sourceSignatures[sourceLen - len + i]), getErasedSignature(targetSignatures[targetLen - len + i]));
25060+ if (sourceLen > 0) {
25061+ // We match source and target signatures from the bottom up, and if the source has fewer signatures
25062+ // than the target, we infer from the first source signature to the excess target signatures.
25063+ const targetSignatures = getSignaturesOfType(target, kind);
25064+ const targetLen = targetSignatures.length;
25065+ for (let i = 0; i < targetLen; i++) {
25066+ const sourceIndex = Math.max(sourceLen - targetLen + i, 0);
25067+ inferFromSignature(getBaseSignature(sourceSignatures[sourceIndex]), getErasedSignature(targetSignatures[i]));
25068+ }
2506525069 }
2506625070 }
2506725071
You can’t perform that action at this time.
0 commit comments