Skip to content

Commit 1784567

Browse files
committed
skip over any and void
1 parent 517f1d5 commit 1784567

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/compiler/checker.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28932,8 +28932,11 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker {
2893228932
// and that call signature is non-generic, return statements are contextually typed by the return type of the signature
2893328933
const signature = getContextualSignatureForFunctionLikeDeclaration(functionDecl as FunctionExpression);
2893428934
if (signature && !isResolvingReturnTypeOfSignature(signature)) {
28935-
const functionFlags = getFunctionFlags(functionDecl);
2893628935
const returnType = getReturnTypeOfSignature(signature);
28936+
if (returnType.flags & (TypeFlags.Any | TypeFlags.Void)) {
28937+
return returnType;
28938+
}
28939+
const functionFlags = getFunctionFlags(functionDecl);
2893728940
if (functionFlags & FunctionFlags.Generator) {
2893828941
return filterType(returnType, t => checkGeneratorInstantiationAssignabilityToReturnType(t, functionFlags, /*errorNode*/ undefined));
2893928942
}

0 commit comments

Comments
 (0)