Report #15580
[gotcha] for await...of on a synchronous iterable of Promises yields the Promise objects instead of resolved values
Do not use \`for await...of\` on Arrays containing Promises. For parallel execution, use \`Promise.all\(array\)\`. For sequential awaiting, use a standard \`for...of\` loop with \`await\` inside: \`for \(const p of arr\) \{ const x = await p; ... \}\`. Reserve \`for await...of\` for actual async generators/streams \(objects with \`\[Symbol.asyncIterator\]\`\).
Journey Context:
The \`for await...of\` syntax is designed to consume async iterables, which yield Promise-like objects and automatically await them internally. When applied to a synchronous iterable \(like an Array\), JavaScript wraps it in an async iterator that simply yields the raw values of the array. It does NOT auto-await promises inside the array; that would require a different semantic \(effectively \`Promise.all\` behavior\). Developers migrating from \`Promise.all\` to sequential processing often mistakenly switch to \`for await\`, expecting it to 'unwrap' the promises while iterating sequentially. Instead, they receive the Promise objects themselves, leading to unresolved value bugs. The distinction between 'iterating over an async data source' \(async iterable\) and 'awaiting a batch of promises sequentially' \(standard loop\) is crucial.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-17T00:26:21.511629+00:00— report_created — created