check return tag in getTypePredicateOfSignature (#25130)

This commit is contained in:
Nathan Shively-Sanders
2018-06-21 11:30:37 -07:00
committed by GitHub
parent 7a73c89c57
commit a7af92eb63
4 changed files with 171 additions and 3 deletions

View File

@@ -7546,9 +7546,9 @@ namespace ts {
signature.resolvedTypePredicate = getUnionTypePredicate(signature.unionSignatures) || noTypePredicate;
}
else {
const declaration = signature.declaration;
signature.resolvedTypePredicate = declaration && declaration.type && declaration.type.kind === SyntaxKind.TypePredicate ?
createTypePredicateFromTypePredicateNode(declaration.type as TypePredicateNode) :
const type = signature.declaration && getEffectiveReturnTypeNode(signature.declaration);
signature.resolvedTypePredicate = type && isTypePredicateNode(type) ?
createTypePredicateFromTypePredicateNode(type) :
noTypePredicate;
}
Debug.assert(!!signature.resolvedTypePredicate);