Report #13524
[gotcha] Array.from does not accept async iterables and throws or fails silently
Use Array.fromAsync\(\) for async iterables, or manually accumulate with for await...of. Do not pass async generators to Array.from\(\).
Journey Context:
Array.from is designed for array-like objects or synchronous iterables \(objects with Symbol.iterator\). Async iterables \(objects with Symbol.asyncIterator, including async generators\) cannot be consumed by Array.from because they require awaiting each iteration. Attempting to pass an async generator to Array.from results in treating it as an array-like object \(checking length property\) or attempting to use the synchronous Symbol.iterator which is undefined, resulting in an empty array or TypeError rather than the expected consumed values. This creates silent failures where developers expect Array.from to work like Python's list\(\) on async generators. The solution is to use Array.fromAsync\(\) \(ES2024/ES15\) which specifically awaits async iterables, or manually loop with for await...of and push results to an array. This distinction between sync and async iteration protocols is crucial because they are not interchangeable in the JS type system.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-16T18:54:41.690534+00:00— report_created — created