Skip to content

Commit 9dac65f

Browse files
author
Andy Hanson
committed
Use undefinedWideningType
1 parent 2fbcd36 commit 9dac65f

25 files changed

+88
-42
lines changed

src/compiler/checker.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18389,7 +18389,7 @@ namespace ts {
1838918389

1839018390
function getYieldedTypeOfYieldExpression(node: YieldExpression, isAsync: boolean, checkMode?: CheckMode): Type {
1839118391
const errorNode = node.expression || node;
18392-
const expressionType = node.expression ? checkExpressionCached(node.expression, checkMode) : undefinedType;
18392+
const expressionType = node.expression ? checkExpressionCached(node.expression, checkMode) : undefinedWideningType;
1839318393
// A yield* expression effectively yields everything that its operand yields
1839418394
const yieldedType = node.asteriskToken ? checkIteratedTypeOrElementType(expressionType, errorNode, /*allowStringInput*/ false, isAsync) : expressionType;
1839518395
return !isAsync ? yieldedType : getAwaitedType(yieldedType, errorNode, node.asteriskToken

tests/baselines/reference/emitter.asyncGenerators.classMethods.es2015.types

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ class C2 {
1111
>C2 : C2
1212

1313
async * f() {
14-
>f : () => AsyncIterableIterator<undefined>
14+
>f : () => AsyncIterableIterator<any>
1515

1616
const x = yield;
1717
>x : any

tests/baselines/reference/emitter.asyncGenerators.classMethods.es5.types

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ class C2 {
1111
>C2 : C2
1212

1313
async * f() {
14-
>f : () => AsyncIterableIterator<undefined>
14+
>f : () => AsyncIterableIterator<any>
1515

1616
const x = yield;
1717
>x : any

tests/baselines/reference/emitter.asyncGenerators.classMethods.esnext.types

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ class C2 {
1111
>C2 : C2
1212

1313
async * f() {
14-
>f : () => AsyncIterableIterator<undefined>
14+
>f : () => AsyncIterableIterator<any>
1515

1616
const x = yield;
1717
>x : any

tests/baselines/reference/emitter.asyncGenerators.functionDeclarations.es2015.types

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ async function * f1() {
44
}
55
=== tests/cases/conformance/emitter/es2015/asyncGenerators/F2.ts ===
66
async function * f2() {
7-
>f2 : () => AsyncIterableIterator<undefined>
7+
>f2 : () => AsyncIterableIterator<any>
88

99
const x = yield;
1010
>x : any

tests/baselines/reference/emitter.asyncGenerators.functionDeclarations.es5.types

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ async function * f1() {
44
}
55
=== tests/cases/conformance/emitter/es5/asyncGenerators/F2.ts ===
66
async function * f2() {
7-
>f2 : () => AsyncIterableIterator<undefined>
7+
>f2 : () => AsyncIterableIterator<any>
88

99
const x = yield;
1010
>x : any

tests/baselines/reference/emitter.asyncGenerators.functionDeclarations.esnext.types

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ async function * f1() {
44
}
55
=== tests/cases/conformance/emitter/esnext/asyncGenerators/F2.ts ===
66
async function * f2() {
7-
>f2 : () => AsyncIterableIterator<undefined>
7+
>f2 : () => AsyncIterableIterator<any>
88

99
const x = yield;
1010
>x : any

tests/baselines/reference/emitter.asyncGenerators.functionExpressions.es2015.types

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@ const f1 = async function * () {
55
}
66
=== tests/cases/conformance/emitter/es2015/asyncGenerators/F2.ts ===
77
const f2 = async function * () {
8-
>f2 : () => AsyncIterableIterator<undefined>
9-
>async function * () { const x = yield;} : () => AsyncIterableIterator<undefined>
8+
>f2 : () => AsyncIterableIterator<any>
9+
>async function * () { const x = yield;} : () => AsyncIterableIterator<any>
1010

1111
const x = yield;
1212
>x : any

tests/baselines/reference/emitter.asyncGenerators.functionExpressions.es5.types

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@ const f1 = async function * () {
55
}
66
=== tests/cases/conformance/emitter/es5/asyncGenerators/F2.ts ===
77
const f2 = async function * () {
8-
>f2 : () => AsyncIterableIterator<undefined>
9-
>async function * () { const x = yield;} : () => AsyncIterableIterator<undefined>
8+
>f2 : () => AsyncIterableIterator<any>
9+
>async function * () { const x = yield;} : () => AsyncIterableIterator<any>
1010

1111
const x = yield;
1212
>x : any

tests/baselines/reference/emitter.asyncGenerators.functionExpressions.esnext.types

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@ const f1 = async function * () {
55
}
66
=== tests/cases/conformance/emitter/esnext/asyncGenerators/F2.ts ===
77
const f2 = async function * () {
8-
>f2 : () => AsyncIterableIterator<undefined>
9-
>async function * () { const x = yield;} : () => AsyncIterableIterator<undefined>
8+
>f2 : () => AsyncIterableIterator<any>
9+
>async function * () { const x = yield;} : () => AsyncIterableIterator<any>
1010

1111
const x = yield;
1212
>x : any

0 commit comments

Comments
 (0)