mirror of
https://github.com/vercel-labs/scriptc.git
synced 2026-10-27 06:43:19 +08:00
Iterable<T> maps to a union of the sources that keep their own representation (T[], Set<T>, Map<K, V> for [K, V] entries, string) and a generator over T that holds every iterator. An array stays the same multi-pass object; a generator stays single-pass. for-of gives the array arm its own array loop, so iterating an Iterable that holds an array runs at array speed. Spread, Array.from, the Set/Map constructors and Object.fromEntries consume it; optional Iterables narrow into it; generator functions may declare an Iterable return. Class iterables and typed arrays are refused at the conversion with a named diagnostic. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>