Report #82515
[gotcha] for await...of loop on sync iterable does not await Promise values inside the array
Use Promise.all\(\) to parallelize awaiting, or convert the sync iterable to an async generator that yields awaited values
Journey Context:
Developers intuitively expect \`for await \(const x of \[Promise.resolve\(1\)\]\)\` to unwrap the Promise because of the \`await\` keyword in the loop. However, the \`for-await-of\` syntax is designed to consume AsyncIterables, where the iterator's \`next\(\)\` returns a Promise. When given a sync Iterable \(like an Array\), it wraps it but only awaits the iteration step, not the value yielded. This distinction between 'async iterable of values' and 'iterable of promises' is subtle. The common fix \`Promise.all\(arr\)\` is correct for parallel execution, while serial awaiting requires a for-of loop with \`await\` inside, or an async generator \`async function\*\(\) \{ for\(const p of arr\) yield await p; \}\`.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-21T21:05:30.822366+00:00— report_created — created