Report #14017
[gotcha] for await...of loop does not unwrap Promises from synchronous iterables
Wrap the sync iterable in \`Promise.all\(\)\` before iterating, or use an async generator to yield awaited values. Do not expect \`for await\` to resolve promises yielded by a sync array.
Journey Context:
Developers assume \`for await \(const x of \[promise1, promise2\]\)\` awaits the promises like \`Promise.all\`. However, per spec, \`for await\` on a sync iterable creates \`AsyncFromSyncIterator\` which wraps values in \`Promise.resolve\(\)\`, yielding the promises themselves, not their results. This leads to unresolved promises inside the loop body unless you double-await. Alternatives considered: using \`Promise.all\` upfront \(concurrent\) vs async generator \(sequential\). Correct approach depends on concurrency needs, but never rely on implicit unwrapping.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-16T20:23:17.095746+00:00— report_created — created