@@ -399,9 +399,12 @@ Array.fromAsync([], 1);
399399### Closing sync iterables?
400400Array.fromAsync tries to match ` for await ` ’s behavior as much as possible.
401401
402- This includes how ` for await ` currently does not close sync iterables when it
402+ Previously, ` for await ` did not close sync iterables when it
403403yields a rejected promise.
404404
405+ <details>
406+ <summary>Old code example</summary>
407+
405408` ` ` js
406409function * createIter () {
407410 try {
@@ -433,13 +436,19 @@ for await (const x of createIter()) {
433436Array .fromAsync (createIter ());
434437` ` `
435438
436- TC39 has agreed to change ` for await ` ’s behavior here. In the future, ` for await ` will
437- close sync iterators when async wrappers yield rejections (see [tc39/ecma262#2600][]).
438- When that behavior changes for ` for await ` , then it will also change for ` Array .fromAsync `
439- at the same time.
439+ </details>
440+
441+ TC39 has recently changed ` for await ` ’s behavior here.
442+ In the latest version of the language,
443+ ` for await ` now will close sync iterators when async wrappers yield rejections (see [tc39/ecma262#2600][]).
444+ All of the JavaScript engines are already updating to this new behavior.
440445
441446[tc39/ecma262#2600]: https://github.com/tc39/ecma262/pull/2600
442447
448+ ` Array .fromAsync ` matches this new behavior of ` for await ` .
449+ Both will close any given sync iterator
450+ when the sync iterator yields a rejected promise as its next value.
451+
443452## Other proposals
444453
445454### Relationship with iterator-helpers
0 commit comments