We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
With PR #11326 now merged, isn't this supposed to work?
TypeScript Version: Version 2.3.0-dev.20170217
Node version v6.9.1
Command line
tsc --target es6 --lib esnext --outFile for-await.js for-await.ts ; node for-await.js
Code
function delay(ms) { return new Promise((resolve, reject) => { setTimeout(resolve, ms); }); } async function* numbers() { yield 1; await delay(500); yield 2; await delay(1000); yield 3; await delay(2000); yield 4; } (async () => { let n = numbers(); console.log(await n.next()); console.log(await n.next()); console.log(await n.next()); console.log(await n.next()); console.log(await n.next()); for await (let next of numbers()) { console.log(next); } })();
Expected behavior:
{ value: 1, done: false } { value: 2, done: false } { value: 3, done: false } { value: 4, done: false } { value: undefined, done: true } 1 2 3 4
Actual behavior:
{ value: 1, done: false } { value: 2, done: false } { value: 3, done: false } { value: 4, done: false } { value: undefined, done: true } undefined undefined undefined undefined undefined undefined undefined undefined undefined ...
The text was updated successfully, but these errors were encountered:
There are two underlying issues here:
for-await-of
await
Symbol.asyncIterator
I'm working on a fix for (1) and part of (2) now. Afterwards you will need to ensure you have a shim for Symbol.asyncIterator, for example:
(<any>Symbol).asyncIterator = Symbol.asyncIterator || Symbol.for("Symbol.asyncIterator");
TypeScript does not currently plan to emit this shim itself, as it could collide with existing shim libraries.
Sorry, something went wrong.
Awesome, thanks! 👍
rbuckton
No branches or pull requests
With PR #11326 now merged, isn't this supposed to work?
TypeScript Version:
Version 2.3.0-dev.20170217
Node version
v6.9.1
Command line
tsc --target es6 --lib esnext --outFile for-await.js for-await.ts ; node for-await.js
Code
Expected behavior:
Actual behavior:
The text was updated successfully, but these errors were encountered: