Skip to content

Commit

Permalink
Temporarily revert change
Browse files Browse the repository at this point in the history
  • Loading branch information
rbuckton committed May 23, 2024
1 parent d6bdb1a commit 282ba0f
Showing 1 changed file with 11 additions and 10 deletions.
21 changes: 11 additions & 10 deletions src/compiler/checker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30840,16 +30840,17 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker {
contextualReturnType = filterType(contextualReturnType, type => !!getIterationTypeOfGeneratorFunctionReturnType(IterationTypeKind.Return, type, isAsyncGenerator));
}
if (node.asteriskToken) {
const iterationTypes = getIterationTypesOfGeneratorFunctionReturnType(contextualReturnType, isAsyncGenerator);
const yieldType = iterationTypes?.yieldType ?? silentNeverType;
const returnType = getContextualType(node, contextFlags) ?? silentNeverType;
const nextType = iterationTypes?.nextType ?? unknownType;
const generatorType = createGeneratorType(yieldType, returnType, nextType, /*isAsyncGenerator*/ false);
if (isAsyncGenerator) {
const asyncGeneratorType = createGeneratorType(yieldType, returnType, nextType, /*isAsyncGenerator*/ true);
return getUnionType([generatorType, asyncGeneratorType]);
}
return generatorType;
// const iterationTypes = getIterationTypesOfGeneratorFunctionReturnType(contextualReturnType, isAsyncGenerator);
// const yieldType = iterationTypes?.yieldType ?? silentNeverType;
// const returnType = getContextualType(node, contextFlags) ?? silentNeverType;
// const nextType = iterationTypes?.nextType ?? unknownType;
// const generatorType = createGeneratorType(yieldType, returnType, nextType, /*isAsyncGenerator*/ false);
// if (isAsyncGenerator) {
// const asyncGeneratorType = createGeneratorType(yieldType, returnType, nextType, /*isAsyncGenerator*/ true);
// return getUnionType([generatorType, asyncGeneratorType]);
// }
// return generatorType;
return contextualReturnType;
}
return getIterationTypeOfGeneratorFunctionReturnType(IterationTypeKind.Yield, contextualReturnType, isAsyncGenerator);
}
Expand Down

0 comments on commit 282ba0f

Please sign in to comment.