TypeScript/tests/cases/conformance/types/asyncGenerators/types.asyncGenerators.es2018.2.ts
Kagami Sascha Rosylight 6249b4c704 Remove ES2018 transforms for ES2018 target (#26315)
* rename esnext.ts as es2018.ts

* remove ES2018 transforms for ES2018 target

* change target from esnext to es2018

* rename tests
2019-02-06 15:35:52 -08:00

79 lines
2.4 KiB
TypeScript

// @target: es2018
// @lib: esnext
// @noEmit: true
async function * inferReturnType1() {
yield* {};
}
async function * inferReturnType2() {
yield* inferReturnType2();
}
async function * inferReturnType3() {
yield* Promise.resolve([1, 2]);
}
const assignability1: () => AsyncIterableIterator<number> = async function * () {
yield "a";
};
const assignability2: () => AsyncIterableIterator<number> = async function * () {
yield* ["a", "b"];
};
const assignability3: () => AsyncIterableIterator<number> = async function * () {
yield* (async function * () { yield "a"; })();
};
const assignability4: () => AsyncIterable<number> = async function * () {
yield "a";
};
const assignability5: () => AsyncIterable<number> = async function * () {
yield* ["a", "b"];
};
const assignability6: () => AsyncIterable<number> = async function * () {
yield* (async function * () { yield "a"; })();
};
const assignability7: () => AsyncIterator<number> = async function * () {
yield "a";
};
const assignability8: () => AsyncIterator<number> = async function * () {
yield* ["a", "b"];
};
const assignability9: () => AsyncIterator<number> = async function * () {
yield* (async function * () { yield "a"; })();
};
async function * explicitReturnType1(): AsyncIterableIterator<number> {
yield "a";
}
async function * explicitReturnType2(): AsyncIterableIterator<number> {
yield* ["a", "b"];
}
async function * explicitReturnType3(): AsyncIterableIterator<number> {
yield* (async function * () { yield "a"; })();
}
async function * explicitReturnType4(): AsyncIterable<number> {
yield "a";
}
async function * explicitReturnType5(): AsyncIterable<number> {
yield* ["a", "b"];
}
async function * explicitReturnType6(): AsyncIterable<number> {
yield* (async function * () { yield "a"; })();
}
async function * explicitReturnType7(): AsyncIterator<number> {
yield "a";
}
async function * explicitReturnType8(): AsyncIterator<number> {
yield* ["a", "b"];
}
async function * explicitReturnType9(): AsyncIterator<number> {
yield* (async function * () { yield "a"; })();
}
async function * explicitReturnType10(): IterableIterator<number> {
yield 1;
}
async function * explicitReturnType11(): Iterable<number> {
yield 1;
}
async function * explicitReturnType12(): Iterator<number> {
yield 1;
}
async function * yieldStar() {
yield* {};
}