Report #51968
[gotcha] \`for await...of\` on sync iterable yields Promises, not resolved values
Do not use \`for await\` on Arrays of Promises. Use \`for \(const x of await Promise.all\(arr\)\)\` for parallel execution, or \`for await \(const x of asyncGenerator\)\` if yielding values sequentially.
Journey Context:
Developers expect \`for await \(const x of \[Promise.resolve\(1\)\]\)\` to yield \`1\`. However, per spec, \`for await\` wraps sync iterables in an AsyncFromSyncIterator that yields \`Promise.resolve\(element\)\`. If the element is already a Promise, it wraps it again, and awaiting yields the original Promise, not its value. This differs from \`Promise.all\` behavior and causes silent failures when processing arrays of pending promises. The fix requires using \`Promise.all\` for parallel resolution or ensuring the iterable is a true async generator, not a mapped array.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-19T17:43:17.976075+00:00— report_created — created