@@ -19174,14 +19174,17 @@ namespace ts {
1917419174 else if (candidateForTypeArgumentError) {
1917519175 checkTypeArguments(candidateForTypeArgumentError, (node as CallExpression | TaggedTemplateExpression).typeArguments!, /*reportErrors*/ true, fallbackError);
1917619176 }
19177- else if (typeArguments && every(signatures, sig => typeArguments!.length < getMinTypeArgumentCount(sig.typeParameters) || typeArguments!.length > length(sig.typeParameters))) {
19178- diagnostics.add(getTypeArgumentArityError(node, signatures, typeArguments));
19179- }
19180- else if (!isDecorator) {
19181- diagnostics.add(getArgumentArityError(node, signatures, args));
19182- }
19183- else if (fallbackError) {
19184- diagnostics.add(createDiagnosticForNode(node, fallbackError));
19177+ else {
19178+ const signaturesWithCorrectTypeArgumentArity = filter(signatures, s => hasCorrectTypeArgumentArity(s, typeArguments));
19179+ if (signaturesWithCorrectTypeArgumentArity.length === 0) {
19180+ diagnostics.add(getTypeArgumentArityError(node, signatures, typeArguments!));
19181+ }
19182+ else if (!isDecorator) {
19183+ diagnostics.add(getArgumentArityError(node, signaturesWithCorrectTypeArgumentArity, args));
19184+ }
19185+ else if (fallbackError) {
19186+ diagnostics.add(createDiagnosticForNode(node, fallbackError));
19187+ }
1918519188 }
1918619189
1918719190 return produceDiagnostics || !args ? resolveErrorCall(node) : getCandidateForOverloadFailure(node, candidates, args, !!candidatesOutArray);
0 commit comments