Report #102913
[gotcha] for-await-of on a synchronous iterable yields values synchronously, not asynchronously, breaking async iteration expectations
Only use for-await-of on async iterables \(those with Symbol.asyncIterator\). For synchronous iterables, use for-of. If you need to force async behavior, wrap values in Promise.resolve\(\) or use a custom async generator.
Journey Context:
for-await-of is designed for async iterables, but if given a sync iterable, it wraps each value in a resolved promise and yields synchronously \(no microtask delay\). This surprises developers who expect async iteration to always yield asynchronously. The spec \(ES2018\) says for-await-of calls the \[Symbol.asyncIterator\] method; if absent, it falls back to \[Symbol.iterator\] and wraps values. This means no actual async behavior occurs, which can break code relying on microtask ordering or backpressure.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-07-09T15:53:26.122834+00:00— report_created — created