Fix checker handling for empty type argument lists (#34790)

This commit is contained in:
Ron Buckton
2019-10-29 08:56:11 -07:00
committed by GitHub
parent ff590b622e
commit 554bd24734
12 changed files with 80 additions and 22 deletions

View File

@@ -23435,7 +23435,7 @@ namespace ts {
// the declared number of type parameters, the call has an incorrect arity.
const numTypeParameters = length(signature.typeParameters);
const minTypeArgumentCount = getMinTypeArgumentCount(signature.typeParameters);
return !typeArguments ||
return !some(typeArguments) ||
(typeArguments.length >= minTypeArgumentCount && typeArguments.length <= numTypeParameters);
}
@@ -24195,7 +24195,7 @@ namespace ts {
if (isSingleNonGenericCandidate) {
const candidate = candidates[0];
if (typeArguments || !hasCorrectArity(node, args, candidate, signatureHelpTrailingComma)) {
if (some(typeArguments) || !hasCorrectArity(node, args, candidate, signatureHelpTrailingComma)) {
return undefined;
}
if (getSignatureApplicabilityError(node, args, candidate, relation, CheckMode.Normal, /*reportErrors*/ false, /*containingMessageChain*/ undefined)) {
@@ -24216,7 +24216,7 @@ namespace ts {
if (candidate.typeParameters) {
let typeArgumentTypes: Type[] | undefined;
if (typeArguments) {
if (some(typeArguments)) {
typeArgumentTypes = checkTypeArguments(candidate, typeArguments, /*reportErrors*/ false);
if (!typeArgumentTypes) {
candidateForTypeArgumentError = candidate;