diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index b1b3f432ead..e28df84be20 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -7899,11 +7899,14 @@ module ts { } } - function checkYieldExpression(node: YieldExpression): void { + function checkYieldExpression(node: YieldExpression): Type { // Grammar checking if (!(node.parserContextFlags & ParserContextFlags.Yield)) { grammarErrorOnFirstToken(node, Diagnostics.A_yield_expression_is_only_allowed_in_a_generator_declaration); } + + // Both yield and yield* expressions are any + return anyType; } function checkConditionalExpression(node: ConditionalExpression, contextualMapper?: TypeMapper): Type { @@ -8093,8 +8096,7 @@ module ts { case SyntaxKind.OmittedExpression: return undefinedType; case SyntaxKind.YieldExpression: - checkYieldExpression(node); - return unknownType; + return checkYieldExpression(node); } return unknownType; }