Merge pull request #14235 from Microsoft/master-fix14043

[Master] fix 14043 collect return type from return statement in generator function
This commit is contained in:
Yui
2017-03-21 11:06:11 -07:00
committed by GitHub
23 changed files with 532 additions and 26 deletions
+2 -2
View File
@@ -15146,8 +15146,8 @@ namespace ts {
else {
let types: Type[];
if (functionFlags & FunctionFlags.Generator) { // Generator or AsyncGenerator function
types = checkAndAggregateYieldOperandTypes(func, checkMode);
if (types.length === 0) {
types = concatenate(checkAndAggregateYieldOperandTypes(func, checkMode), checkAndAggregateReturnExpressionTypes(func, checkMode));
if (!types || types.length === 0) {
const iterableIteratorAny = functionFlags & FunctionFlags.Async
? createAsyncIterableIteratorType(anyType) // AsyncGenerator function
: createIterableIteratorType(anyType); // Generator function