Fix getSignatureOfTypeTag (#37473)

Prevents infinite looping as in #37265.

Fixes #37265
This commit is contained in:
Eli Barzilay
2020-03-19 19:02:39 -04:00
committed by GitHub
parent 292d01880f
commit ec95c27b4d
5 changed files with 64 additions and 1 deletions

View File

@@ -10701,7 +10701,9 @@ namespace ts {
}
function getSignatureOfTypeTag(node: SignatureDeclaration | JSDocSignature) {
const typeTag = isInJSFile(node) ? getJSDocTypeTag(node) : undefined;
// should be attached to a function declaration or expression
if (!(isInJSFile(node) && isFunctionLikeDeclaration(node))) return undefined;
const typeTag = getJSDocTypeTag(node);
const signature = typeTag && typeTag.typeExpression && getSingleCallSignature(getTypeFromTypeNode(typeTag.typeExpression));
return signature && getErasedSignature(signature);
}