TS 2.3 RC
declare const console: any;
{
(Symbol as any).asyncIterator = Symbol.asyncIterator || "__@@asyncIterator__";
const gen = async function* () {
yield Promise.resolve(10)
yield Promise.resolve(20)
}
const main = async () => {
for await (const y of gen()) {
console.log(y)
}
}
main();
}
This outputs:
❯ tsc && node ./target/AsyncIterable.js
Promise { 10 }
Promise { 20 }
I expected it to output (promises are flattened):