Fill missing type arguments during error reporting

Previously, only the success path did this; it was missing in the error
reporting path in resolveCall. This resulted in crashes for unsupplied
type arguments when the supplied type arguments were incorrect.
This commit is contained in:
Nathan Shively-Sanders 2017-10-11 14:01:25 -07:00
parent 461e29bbd8
commit 3fef16008d

View file

@ -16203,8 +16203,10 @@ namespace ts {
checkApplicableSignature(node, args, candidateForArgumentError, assignableRelation, /*excludeArgument*/ undefined, /*reportErrors*/ true);
}
else if (candidateForTypeArgumentError) {
const isJavascript = isInJavaScriptFile(candidateForTypeArgumentError.declaration);
const typeArguments = (<CallExpression>node).typeArguments;
checkTypeArguments(candidateForTypeArgumentError, typeArguments, map(typeArguments, getTypeFromTypeNode), /*reportErrors*/ true, fallbackError);
const typeArgumentTypes = fillMissingTypeArguments(map(typeArguments, getTypeFromTypeNode), candidateForTypeArgumentError.typeParameters, getMinTypeArgumentCount(candidateForTypeArgumentError.typeParameters), isJavascript);
checkTypeArguments(candidateForTypeArgumentError, typeArguments, typeArgumentTypes, /*reportErrors*/ true, fallbackError);
}
else if (typeArguments && every(signatures, sig => length(sig.typeParameters) !== typeArguments.length)) {
let min = Number.POSITIVE_INFINITY;