mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-05-17 21:06:50 -05:00
Treat 'yield;' as 'yield undefined;' (#22297)
* Treat 'yield;' as 'yield undefined;' * Use undefinedWideningType
This commit is contained in:
@@ -18525,9 +18525,7 @@ namespace ts {
|
||||
const aggregatedTypes: Type[] = [];
|
||||
const isAsync = (getFunctionFlags(func) & FunctionFlags.Async) !== 0;
|
||||
forEachYieldExpression(<Block>func.body, yieldExpression => {
|
||||
if (yieldExpression.expression) { // TODO: GH#22297
|
||||
pushIfUnique(aggregatedTypes, getYieldedTypeOfYieldExpression(yieldExpression, isAsync, checkMode));
|
||||
}
|
||||
pushIfUnique(aggregatedTypes, getYieldedTypeOfYieldExpression(yieldExpression, isAsync, checkMode));
|
||||
});
|
||||
return aggregatedTypes;
|
||||
}
|
||||
@@ -19520,8 +19518,6 @@ namespace ts {
|
||||
}
|
||||
}
|
||||
|
||||
if (!node.expression) return anyType; // TODO: GH#22297
|
||||
|
||||
const isAsync = (functionFlags & FunctionFlags.Async) !== 0;
|
||||
const yieldedType = getYieldedTypeOfYieldExpression(node, isAsync);
|
||||
// There is no point in doing an assignability check if the function
|
||||
|
||||
Reference in New Issue
Block a user