@@ -19246,14 +19246,17 @@ namespace ts {
1924619246 else if (candidateForTypeArgumentError) {
1924719247 checkTypeArguments(candidateForTypeArgumentError, (node as CallExpression | TaggedTemplateExpression).typeArguments!, /*reportErrors*/ true, fallbackError);
1924819248 }
19249- else if (typeArguments && every(signatures, sig => typeArguments!.length < getMinTypeArgumentCount(sig.typeParameters) || typeArguments!.length > length(sig.typeParameters))) {
19250- diagnostics.add(getTypeArgumentArityError(node, signatures, typeArguments));
19251- }
19252- else if (!isDecorator) {
19253- diagnostics.add(getArgumentArityError(node, signatures, args));
19254- }
19255- else if (fallbackError) {
19256- diagnostics.add(createDiagnosticForNode(node, fallbackError));
19249+ else {
19250+ const signaturesWithCorrectTypeArgumentArity = filter(signatures, s => hasCorrectTypeArgumentArity(s, typeArguments));
19251+ if (signaturesWithCorrectTypeArgumentArity.length === 0) {
19252+ diagnostics.add(getTypeArgumentArityError(node, signatures, typeArguments!));
19253+ }
19254+ else if (!isDecorator) {
19255+ diagnostics.add(getArgumentArityError(node, signaturesWithCorrectTypeArgumentArity, args));
19256+ }
19257+ else if (fallbackError) {
19258+ diagnostics.add(createDiagnosticForNode(node, fallbackError));
19259+ }
1925719260 }
1925819261
1925919262 return produceDiagnostics || !args ? resolveErrorCall(node) : getCandidateForOverloadFailure(node, candidates, args, !!candidatesOutArray);
0 commit comments