mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-05-16 15:45:27 -05:00
Infer implied arity before inferring from 'this' argument (#39328)
* Infer implied arity before inferring from 'this' argument * Add regression test
This commit is contained in:
@@ -25773,13 +25773,6 @@ namespace ts {
|
||||
}
|
||||
}
|
||||
|
||||
const thisType = getThisTypeOfSignature(signature);
|
||||
if (thisType) {
|
||||
const thisArgumentNode = getThisArgumentOfCall(node);
|
||||
const thisArgumentType = thisArgumentNode ? checkExpression(thisArgumentNode) : voidType;
|
||||
inferTypes(context.inferences, thisArgumentType, thisType);
|
||||
}
|
||||
|
||||
const restType = getNonArrayRestType(signature);
|
||||
const argCount = restType ? Math.min(getParameterCount(signature) - 1, args.length) : args.length;
|
||||
if (restType && restType.flags & TypeFlags.TypeParameter) {
|
||||
@@ -25788,6 +25781,14 @@ namespace ts {
|
||||
info.impliedArity = findIndex(args, isSpreadArgument, argCount) < 0 ? args.length - argCount : undefined;
|
||||
}
|
||||
}
|
||||
|
||||
const thisType = getThisTypeOfSignature(signature);
|
||||
if (thisType) {
|
||||
const thisArgumentNode = getThisArgumentOfCall(node);
|
||||
const thisArgumentType = thisArgumentNode ? checkExpression(thisArgumentNode) : voidType;
|
||||
inferTypes(context.inferences, thisArgumentType, thisType);
|
||||
}
|
||||
|
||||
for (let i = 0; i < argCount; i++) {
|
||||
const arg = args[i];
|
||||
if (arg.kind !== SyntaxKind.OmittedExpression) {
|
||||
|
||||
Reference in New Issue
Block a user