Skip to content

Commit 8204898

Browse files
committed
Improve typing for Generators and Async Generators
1 parent 645853a commit 8204898

File tree

266 files changed

+2949
-1556
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

266 files changed

+2949
-1556
lines changed

src/compiler/checker.ts

Lines changed: 566 additions & 227 deletions
Large diffs are not rendered by default.

src/compiler/commandLineParser.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ namespace ts {
3939
["es2017.string", "lib.es2017.string.d.ts"],
4040
["es2017.intl", "lib.es2017.intl.d.ts"],
4141
["es2017.typedarrays", "lib.es2017.typedarrays.d.ts"],
42+
["es2018.asyncgenerator", "lib.es2018.asyncgenerator.d.ts"],
4243
["es2018.asynciterable", "lib.es2018.asynciterable.d.ts"],
4344
["es2018.intl", "lib.es2018.intl.d.ts"],
4445
["es2018.promise", "lib.es2018.promise.d.ts"],

src/compiler/diagnosticMessages.json

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3899,6 +3899,10 @@
38993899
"category": "Message",
39003900
"code": 6217
39013901
},
3902+
"Enable strict checking of generator types.": {
3903+
"category": "Message",
3904+
"code": 6218
3905+
},
39023906

39033907
"Projects to reference": {
39043908
"category": "Message",
@@ -4256,6 +4260,10 @@
42564260
"category": "Error",
42574261
"code": 7051
42584262
},
4263+
"Generator implicitly has type '{0}' because it does not yield or return any values. Consider supplying a return type.": {
4264+
"category": "Error",
4265+
"code": 7052
4266+
},
42594267

42604268
"You cannot rename this element.": {
42614269
"category": "Error",

src/compiler/types.ts

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4226,13 +4226,21 @@ namespace ts {
42264226
regularType: ResolvedType; // Regular version of fresh type
42274227
}
42284228

4229+
/* @internal */
4230+
export interface IterationTypes {
4231+
yieldType?: Type;
4232+
returnType?: Type;
4233+
nextType?: Type;
4234+
}
4235+
42294236
// Just a place to cache element types of iterables and iterators
42304237
/* @internal */
42314238
export interface IterableOrIteratorType extends ObjectType, UnionType {
4232-
iteratedTypeOfIterable?: Type;
4233-
iteratedTypeOfIterator?: Type;
4234-
iteratedTypeOfAsyncIterable?: Type;
4235-
iteratedTypeOfAsyncIterator?: Type;
4239+
iterationTypesOfIterable?: IterationTypes;
4240+
iterationTypesOfIterator?: IterationTypes;
4241+
iterationTypesOfAsyncIterable?: IterationTypes;
4242+
iterationTypesOfAsyncIterator?: IterationTypes;
4243+
iterationTypesOfIteratorResult?: IterationTypes;
42364244
}
42374245

42384246
/* @internal */

src/harness/vfs.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -683,7 +683,7 @@ namespace vfs {
683683

684684
if (isDirectory(node)) throw createIOError("EISDIR");
685685
if (!isFile(node)) throw createIOError("EBADF");
686-
node.buffer = Buffer.isBuffer(data) ? data.slice() : ts.sys.bufferFrom!("" + data, encoding || "utf8");
686+
node.buffer = Buffer.isBuffer(data) ? data.slice() : ts.sys.bufferFrom!("" + data, encoding || "utf8") as Buffer;
687687
node.size = node.buffer.byteLength;
688688
node.mtimeMs = time;
689689
node.ctimeMs = time;
@@ -1204,7 +1204,7 @@ namespace vfs {
12041204
}
12051205
},
12061206
readFileSync(path: string): Buffer {
1207-
return ts.sys.bufferFrom!(host.readFile(path)!, "utf8"); // TODO: GH#18217
1207+
return ts.sys.bufferFrom!(host.readFile(path)!, "utf8") as Buffer; // TODO: GH#18217
12081208
}
12091209
};
12101210
}

src/lib/es2015.generator.d.ts

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,11 @@
1-
interface Generator extends Iterator<any> { }
1+
/// <reference lib="es2015.iterable" />
2+
3+
interface Generator<TYield = unknown, TReturn = void, TNext = unknown> {
4+
next(value?: TNext): IteratorResult<TYield, TReturn>;
5+
return(value: TReturn): IteratorResult<TYield, TReturn>;
6+
throw(e: any): IteratorResult<TYield, TReturn>;
7+
[Symbol.iterator](): Generator<TYield, TReturn, TNext>;
8+
}
29

310
interface GeneratorFunction {
411
/**

src/lib/es2015.iterable.d.ts

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,18 @@ interface SymbolConstructor {
88
readonly iterator: symbol;
99
}
1010

11-
interface IteratorResult<T> {
12-
done: boolean;
13-
value: T;
11+
interface IteratorYieldResult<TYield> {
12+
done: false;
13+
value: TYield;
1414
}
1515

16+
interface IteratorReturnResult<TReturn> {
17+
done: true;
18+
value: TReturn;
19+
}
20+
21+
type IteratorResult<T, TReturn = T | void> = IteratorYieldResult<T> | IteratorReturnResult<TReturn>;
22+
1623
interface Iterator<T> {
1724
next(value?: any): IteratorResult<T>;
1825
return?(value?: any): IteratorResult<T>;

src/lib/es2018.asyncgenerator.d.ts

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
/// <reference lib="es2018.asynciterable" />
2+
3+
interface AsyncGenerator<TYield = unknown, TReturn = void, TNext = unknown> {
4+
next(value?: TNext): Promise<IteratorResult<TYield, TReturn>>;
5+
return(value: TReturn): Promise<IteratorResult<TYield, TReturn>>;
6+
throw(e: unknown): Promise<IteratorResult<TYield, TReturn>>;
7+
[Symbol.asyncIterator](): AsyncGenerator<TYield, TReturn, TNext>;
8+
}
9+
10+
interface AsyncGeneratorFunction {
11+
/**
12+
* Creates a new AsyncGenerator object.
13+
* @param args A list of arguments the function accepts.
14+
*/
15+
new (...args: any[]): AsyncGenerator;
16+
/**
17+
* Creates a new AsyncGenerator object.
18+
* @param args A list of arguments the function accepts.
19+
*/
20+
(...args: any[]): AsyncGenerator;
21+
/**
22+
* The length of the arguments.
23+
*/
24+
readonly length: number;
25+
/**
26+
* Returns the name of the function.
27+
*/
28+
readonly name: string;
29+
/**
30+
* A reference to the prototype.
31+
*/
32+
readonly prototype: AsyncGenerator;
33+
}
34+
35+
interface AsyncGeneratorFunctionConstructor {
36+
/**
37+
* Creates a new AsyncGenerator function.
38+
* @param args A list of arguments the function accepts.
39+
*/
40+
new (...args: string[]): AsyncGeneratorFunction;
41+
/**
42+
* Creates a new AsyncGenerator function.
43+
* @param args A list of arguments the function accepts.
44+
*/
45+
(...args: string[]): AsyncGeneratorFunction;
46+
/**
47+
* The length of the arguments.
48+
*/
49+
readonly length: number;
50+
/**
51+
* Returns the name of the function.
52+
*/
53+
readonly name: string;
54+
/**
55+
* A reference to the prototype.
56+
*/
57+
readonly prototype: AsyncGeneratorFunction;
58+
}

src/lib/es2018.d.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
/// <reference lib="es2017" />
2+
/// <reference lib="es2018.asyncgenerator" />
23
/// <reference lib="es2018.asynciterable" />
34
/// <reference lib="es2018.promise" />
45
/// <reference lib="es2018.regexp" />

src/lib/libs.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030
"es2017.string",
3131
"es2017.intl",
3232
"es2017.typedarrays",
33+
"es2018.asyncgenerator",
3334
"es2018.asynciterable",
3435
"es2018.regexp",
3536
"es2018.promise",

src/testRunner/parallel/host.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -269,8 +269,8 @@ namespace Harness.Parallel.Host {
269269
worker.accumulatedOutput += d.toString();
270270
console.log(`[Worker ${i}]`, d.toString());
271271
};
272-
worker.process.stderr.on("data", appendOutput);
273-
worker.process.stdout.on("data", appendOutput);
272+
worker.process.stderr!.on("data", appendOutput);
273+
worker.process.stdout!.on("data", appendOutput);
274274
const killChild = (timeout: TaskTimeout) => {
275275
worker.process.kill();
276276
console.error(`Worker exceeded ${timeout.duration}ms timeout ${worker.currentTasks && worker.currentTasks.length ? `while running test '${worker.currentTasks[0].file}'.` : `during test setup.`}`);

src/testRunner/unittests/config/commandLineParsing.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ namespace ts {
5757
assertParseResult(["--lib", "es5,invalidOption", "0.ts"],
5858
{
5959
errors: [{
60-
messageText: "Argument for '--lib' option must be: 'es5', 'es6', 'es2015', 'es7', 'es2016', 'es2017', 'es2018', 'es2019', 'esnext', 'dom', 'dom.iterable', 'webworker', 'webworker.importscripts', 'scripthost', 'es2015.core', 'es2015.collection', 'es2015.generator', 'es2015.iterable', 'es2015.promise', 'es2015.proxy', 'es2015.reflect', 'es2015.symbol', 'es2015.symbol.wellknown', 'es2016.array.include', 'es2017.object', 'es2017.sharedmemory', 'es2017.string', 'es2017.intl', 'es2017.typedarrays', 'es2018.asynciterable', 'es2018.intl', 'es2018.promise', 'es2018.regexp', 'es2019.array', 'es2019.string', 'es2019.symbol', 'esnext.array', 'esnext.symbol', 'esnext.asynciterable', 'esnext.intl', 'esnext.bigint'.",
60+
messageText: "Argument for '--lib' option must be: 'es5', 'es6', 'es2015', 'es7', 'es2016', 'es2017', 'es2018', 'es2019', 'esnext', 'dom', 'dom.iterable', 'webworker', 'webworker.importscripts', 'scripthost', 'es2015.core', 'es2015.collection', 'es2015.generator', 'es2015.iterable', 'es2015.promise', 'es2015.proxy', 'es2015.reflect', 'es2015.symbol', 'es2015.symbol.wellknown', 'es2016.array.include', 'es2017.object', 'es2017.sharedmemory', 'es2017.string', 'es2017.intl', 'es2017.typedarrays', 'es2018.asyncgenerator', 'es2018.asynciterable', 'es2018.intl', 'es2018.promise', 'es2018.regexp', 'es2019.array', 'es2019.string', 'es2019.symbol', 'esnext.array', 'esnext.symbol', 'esnext.asynciterable', 'esnext.intl', 'esnext.bigint'.",
6161
category: Diagnostics.Argument_for_0_option_must_be_Colon_1.category,
6262
code: Diagnostics.Argument_for_0_option_must_be_Colon_1.code,
6363
file: undefined,
@@ -259,7 +259,7 @@ namespace ts {
259259
assertParseResult(["--lib", "es5,", "es7", "0.ts"],
260260
{
261261
errors: [{
262-
messageText: "Argument for '--lib' option must be: 'es5', 'es6', 'es2015', 'es7', 'es2016', 'es2017', 'es2018', 'es2019', 'esnext', 'dom', 'dom.iterable', 'webworker', 'webworker.importscripts', 'scripthost', 'es2015.core', 'es2015.collection', 'es2015.generator', 'es2015.iterable', 'es2015.promise', 'es2015.proxy', 'es2015.reflect', 'es2015.symbol', 'es2015.symbol.wellknown', 'es2016.array.include', 'es2017.object', 'es2017.sharedmemory', 'es2017.string', 'es2017.intl', 'es2017.typedarrays', 'es2018.asynciterable', 'es2018.intl', 'es2018.promise', 'es2018.regexp', 'es2019.array', 'es2019.string', 'es2019.symbol', 'esnext.array', 'esnext.symbol', 'esnext.asynciterable', 'esnext.intl', 'esnext.bigint'.",
262+
messageText: "Argument for '--lib' option must be: 'es5', 'es6', 'es2015', 'es7', 'es2016', 'es2017', 'es2018', 'es2019', 'esnext', 'dom', 'dom.iterable', 'webworker', 'webworker.importscripts', 'scripthost', 'es2015.core', 'es2015.collection', 'es2015.generator', 'es2015.iterable', 'es2015.promise', 'es2015.proxy', 'es2015.reflect', 'es2015.symbol', 'es2015.symbol.wellknown', 'es2016.array.include', 'es2017.object', 'es2017.sharedmemory', 'es2017.string', 'es2017.intl', 'es2017.typedarrays', 'es2018.asyncgenerator', 'es2018.asynciterable', 'es2018.intl', 'es2018.promise', 'es2018.regexp', 'es2019.array', 'es2019.string', 'es2019.symbol', 'esnext.array', 'esnext.symbol', 'esnext.asynciterable', 'esnext.intl', 'esnext.bigint'.",
263263
category: Diagnostics.Argument_for_0_option_must_be_Colon_1.category,
264264
code: Diagnostics.Argument_for_0_option_must_be_Colon_1.code,
265265
file: undefined,
@@ -278,7 +278,7 @@ namespace ts {
278278
assertParseResult(["--lib", "es5, ", "es7", "0.ts"],
279279
{
280280
errors: [{
281-
messageText: "Argument for '--lib' option must be: 'es5', 'es6', 'es2015', 'es7', 'es2016', 'es2017', 'es2018', 'es2019', 'esnext', 'dom', 'dom.iterable', 'webworker', 'webworker.importscripts', 'scripthost', 'es2015.core', 'es2015.collection', 'es2015.generator', 'es2015.iterable', 'es2015.promise', 'es2015.proxy', 'es2015.reflect', 'es2015.symbol', 'es2015.symbol.wellknown', 'es2016.array.include', 'es2017.object', 'es2017.sharedmemory', 'es2017.string', 'es2017.intl', 'es2017.typedarrays', 'es2018.asynciterable', 'es2018.intl', 'es2018.promise', 'es2018.regexp', 'es2019.array', 'es2019.string', 'es2019.symbol', 'esnext.array', 'esnext.symbol', 'esnext.asynciterable', 'esnext.intl', 'esnext.bigint'.",
281+
messageText: "Argument for '--lib' option must be: 'es5', 'es6', 'es2015', 'es7', 'es2016', 'es2017', 'es2018', 'es2019', 'esnext', 'dom', 'dom.iterable', 'webworker', 'webworker.importscripts', 'scripthost', 'es2015.core', 'es2015.collection', 'es2015.generator', 'es2015.iterable', 'es2015.promise', 'es2015.proxy', 'es2015.reflect', 'es2015.symbol', 'es2015.symbol.wellknown', 'es2016.array.include', 'es2017.object', 'es2017.sharedmemory', 'es2017.string', 'es2017.intl', 'es2017.typedarrays', 'es2018.asyncgenerator', 'es2018.asynciterable', 'es2018.intl', 'es2018.promise', 'es2018.regexp', 'es2019.array', 'es2019.string', 'es2019.symbol', 'esnext.array', 'esnext.symbol', 'esnext.asynciterable', 'esnext.intl', 'esnext.bigint'.",
282282
category: Diagnostics.Argument_for_0_option_must_be_Colon_1.category,
283283
code: Diagnostics.Argument_for_0_option_must_be_Colon_1.code,
284284
file: undefined,

src/tsconfig-base.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"compilerOptions": {
33
"pretty": true,
4-
"lib": ["es2015.iterable", "es5"],
4+
"lib": ["es2015.iterable", "es2015.generator", "es5"],
55
"target": "es5",
66
"rootDir": ".",
77

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
=== tests/cases/conformance/es6/functionDeclarations/FunctionDeclaration11_es6.ts ===
22
function * yield() {
3-
>yield : () => IterableIterator<any>
3+
>yield : () => Generator<never, void, unknown>
44
}

tests/baselines/reference/FunctionDeclaration13_es6.types

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
=== tests/cases/conformance/es6/functionDeclarations/FunctionDeclaration13_es6.ts ===
22
function * foo() {
3-
>foo : () => IterableIterator<any>
3+
>foo : () => Generator<never, void, unknown>
44

55
// Legal to use 'yield' in a type context.
66
var v: yield;
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
=== tests/cases/conformance/es6/functionDeclarations/FunctionDeclaration1_es6.ts ===
22
function * foo() {
3-
>foo : () => IterableIterator<any>
3+
>foo : () => Generator<never, void, unknown>
44
}
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
=== tests/cases/conformance/es6/functionDeclarations/FunctionDeclaration6_es6.ts ===
22
function*foo(a = yield) {
3-
>foo : (a?: any) => IterableIterator<any>
3+
>foo : (a?: any) => Generator<never, void, unknown>
44
>a : any
55
>yield : any
66
}

tests/baselines/reference/FunctionDeclaration7_es6.types

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
=== tests/cases/conformance/es6/functionDeclarations/FunctionDeclaration7_es6.ts ===
22
function*bar() {
3-
>bar : () => IterableIterator<any>
3+
>bar : () => Generator<never, void, unknown>
44

55
// 'yield' here is an identifier, and not a yield expression.
66
function*foo(a = yield) {
7-
>foo : (a?: any) => IterableIterator<any>
7+
>foo : (a?: any) => Generator<never, void, unknown>
88
>a : any
99
>yield : any
1010
}
Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
=== tests/cases/conformance/es6/functionDeclarations/FunctionDeclaration9_es6.ts ===
22
function * foo() {
3-
>foo : () => IterableIterator<any>
3+
>foo : () => Generator<any, void, unknown>
44

55
var v = { [yield]: foo }
6-
>v : { [x: number]: () => IterableIterator<any>; }
7-
>{ [yield]: foo } : { [x: number]: () => IterableIterator<any>; }
8-
>[yield] : () => IterableIterator<any>
6+
>v : { [x: number]: () => Generator<any, void, unknown>; }
7+
>{ [yield]: foo } : { [x: number]: () => Generator<any, void, unknown>; }
8+
>[yield] : () => Generator<any, void, unknown>
99
>yield : any
10-
>foo : () => IterableIterator<any>
10+
>foo : () => Generator<any, void, unknown>
1111
}
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
=== tests/cases/conformance/es6/functionExpressions/FunctionExpression1_es6.ts ===
22
var v = function * () { }
3-
>v : () => IterableIterator<any>
4-
>function * () { } : () => IterableIterator<any>
3+
>v : () => Generator<never, void, unknown>
4+
>function * () { } : () => Generator<never, void, unknown>
55

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
=== tests/cases/conformance/es6/functionExpressions/FunctionExpression2_es6.ts ===
22
var v = function * foo() { }
3-
>v : () => IterableIterator<any>
4-
>function * foo() { } : () => IterableIterator<any>
5-
>foo : () => IterableIterator<any>
3+
>v : () => Generator<never, void, unknown>
4+
>function * foo() { } : () => Generator<never, void, unknown>
5+
>foo : () => Generator<never, void, unknown>
66

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
=== tests/cases/conformance/es6/functionPropertyAssignments/FunctionPropertyAssignments1_es6.ts ===
22
var v = { *foo() { } }
3-
>v : { foo(): IterableIterator<any>; }
4-
>{ *foo() { } } : { foo(): IterableIterator<any>; }
5-
>foo : () => IterableIterator<any>
3+
>v : { foo(): Generator<never, void, unknown>; }
4+
>{ *foo() { } } : { foo(): Generator<never, void, unknown>; }
5+
>foo : () => Generator<never, void, unknown>
66

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
=== tests/cases/conformance/es6/functionPropertyAssignments/FunctionPropertyAssignments2_es6.ts ===
22
var v = { *() { } }
3-
>v : { (Missing)(): IterableIterator<any>; }
4-
>{ *() { } } : { (Missing)(): IterableIterator<any>; }
5-
> : () => IterableIterator<any>
3+
>v : { (Missing)(): Generator<never, void, unknown>; }
4+
>{ *() { } } : { (Missing)(): Generator<never, void, unknown>; }
5+
> : () => Generator<never, void, unknown>
66

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
=== tests/cases/conformance/es6/functionPropertyAssignments/FunctionPropertyAssignments3_es6.ts ===
22
var v = { *{ } }
3-
>v : { (Missing)(): IterableIterator<any>; }
4-
>{ *{ } } : { (Missing)(): IterableIterator<any>; }
5-
> : () => IterableIterator<any>
3+
>v : { (Missing)(): Generator<never, void, unknown>; }
4+
>{ *{ } } : { (Missing)(): Generator<never, void, unknown>; }
5+
> : () => Generator<never, void, unknown>
66

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
=== tests/cases/conformance/es6/functionPropertyAssignments/FunctionPropertyAssignments5_es6.ts ===
22
var v = { *[foo()]() { } }
3-
>v : { [x: number]: () => IterableIterator<any>; }
4-
>{ *[foo()]() { } } : { [x: number]: () => IterableIterator<any>; }
5-
>[foo()] : () => IterableIterator<any>
3+
>v : { [x: number]: () => Generator<never, void, unknown>; }
4+
>{ *[foo()]() { } } : { [x: number]: () => Generator<never, void, unknown>; }
5+
>[foo()] : () => Generator<never, void, unknown>
66
>foo() : any
77
>foo : any
88

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
=== tests/cases/conformance/es6/functionPropertyAssignments/FunctionPropertyAssignments6_es6.ts ===
22
var v = { *<T>() { } }
3-
>v : { (Missing)<T>(): IterableIterator<any>; }
4-
>{ *<T>() { } } : { (Missing)<T>(): IterableIterator<any>; }
5-
> : <T>() => IterableIterator<any>
3+
>v : { (Missing)<T>(): Generator<never, void, unknown>; }
4+
>{ *<T>() { } } : { (Missing)<T>(): Generator<never, void, unknown>; }
5+
> : <T>() => Generator<never, void, unknown>
66

tests/baselines/reference/MemberFunctionDeclaration1_es6.types

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,5 @@ class C {
33
>C : C
44

55
*foo() { }
6-
>foo : () => IterableIterator<any>
6+
>foo : () => Generator<never, void, unknown>
77
}

tests/baselines/reference/MemberFunctionDeclaration2_es6.types

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,5 @@ class C {
33
>C : C
44

55
public * foo() { }
6-
>foo : () => IterableIterator<any>
6+
>foo : () => Generator<never, void, unknown>
77
}

tests/baselines/reference/MemberFunctionDeclaration3_es6.types

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,6 @@ class C {
33
>C : C
44

55
*[foo]() { }
6-
>[foo] : () => IterableIterator<any>
6+
>[foo] : () => Generator<never, void, unknown>
77
>foo : any
88
}

tests/baselines/reference/MemberFunctionDeclaration4_es6.types

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,5 @@ class C {
33
>C : C
44

55
*() { }
6-
> : () => IterableIterator<any>
6+
> : () => Generator<never, void, unknown>
77
}

tests/baselines/reference/MemberFunctionDeclaration7_es6.types

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,5 @@ class C {
33
>C : C
44

55
*foo<T>() { }
6-
>foo : <T>() => IterableIterator<any>
6+
>foo : <T>() => Generator<never, void, unknown>
77
}

0 commit comments

Comments
 (0)