No contextual return type when type is circular
This commit is contained in:
parent
a6a27ab661
commit
dacc851434
1 changed files with 5 additions and 1 deletions
|
@ -6576,6 +6576,10 @@ namespace ts {
|
|||
return signature.resolvedReturnType;
|
||||
}
|
||||
|
||||
function isResolvingReturnTypeOfSignature(signature: Signature) {
|
||||
return !signature.resolvedReturnType && findResolutionCycleStartIndex(signature, TypeSystemPropertyName.ResolvedReturnType) >= 0;
|
||||
}
|
||||
|
||||
function getRestTypeOfSignature(signature: Signature): Type {
|
||||
if (signature.hasRestParameter) {
|
||||
const type = getTypeOfSymbol(lastOrUndefined(signature.parameters));
|
||||
|
@ -12949,7 +12953,7 @@ namespace ts {
|
|||
// Otherwise, if the containing function is contextually typed by a function type with exactly one call signature
|
||||
// and that call signature is non-generic, return statements are contextually typed by the return type of the signature
|
||||
const signature = getContextualSignatureForFunctionLikeDeclaration(<FunctionExpression>functionDecl);
|
||||
if (signature) {
|
||||
if (signature && !isResolvingReturnTypeOfSignature(signature)) {
|
||||
return getReturnTypeOfSignature(signature);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue