mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-05-31 18:10:56 -05:00
Fixed an issue with generic naked T not being allowed as async generator's return (#49023)
This commit is contained in:
committed by
GitHub
parent
a21024dbe7
commit
cd3bd5522b
@@ -39273,9 +39273,14 @@ namespace ts {
|
||||
function unwrapReturnType(returnType: Type, functionFlags: FunctionFlags) {
|
||||
const isGenerator = !!(functionFlags & FunctionFlags.Generator);
|
||||
const isAsync = !!(functionFlags & FunctionFlags.Async);
|
||||
return isGenerator ? getIterationTypeOfGeneratorFunctionReturnType(IterationTypeKind.Return, returnType, isAsync) || errorType :
|
||||
isAsync ? getAwaitedTypeNoAlias(returnType) || errorType :
|
||||
returnType;
|
||||
if (isGenerator) {
|
||||
const returnIterationType = getIterationTypeOfGeneratorFunctionReturnType(IterationTypeKind.Return, returnType, isAsync);
|
||||
if (!returnIterationType) {
|
||||
return errorType;
|
||||
}
|
||||
return isAsync ? getAwaitedTypeNoAlias(unwrapAwaitedType(returnIterationType)) : returnIterationType;
|
||||
}
|
||||
return isAsync ? getAwaitedTypeNoAlias(returnType) || errorType : returnType;
|
||||
}
|
||||
|
||||
function isUnwrappedReturnTypeVoidOrAny(func: SignatureDeclaration, returnType: Type): boolean {
|
||||
|
||||
Reference in New Issue
Block a user