Skip to content

Commit eada0cd

Browse files
committed
Yield and yield* have type any
1 parent 65222d6 commit eada0cd

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

src/compiler/checker.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7899,11 +7899,14 @@ module ts {
78997899
}
79007900
}
79017901

7902-
function checkYieldExpression(node: YieldExpression): void {
7902+
function checkYieldExpression(node: YieldExpression): Type {
79037903
// Grammar checking
79047904
if (!(node.parserContextFlags & ParserContextFlags.Yield)) {
79057905
grammarErrorOnFirstToken(node, Diagnostics.A_yield_expression_is_only_allowed_in_a_generator_declaration);
79067906
}
7907+
7908+
// Both yield and yield* expressions are any
7909+
return anyType;
79077910
}
79087911

79097912
function checkConditionalExpression(node: ConditionalExpression, contextualMapper?: TypeMapper): Type {
@@ -8093,8 +8096,7 @@ module ts {
80938096
case SyntaxKind.OmittedExpression:
80948097
return undefinedType;
80958098
case SyntaxKind.YieldExpression:
8096-
checkYieldExpression(<YieldExpression>node);
8097-
return unknownType;
8099+
return checkYieldExpression(<YieldExpression>node);
80988100
}
80998101
return unknownType;
81008102
}

0 commit comments

Comments
 (0)