mirror of
https://github.com/vercel-labs/scriptc.git
synced 2026-10-22 05:59:31 +08:00
The ESNext array lib is now part of the type world, and Array.fromAsync(source, mapFn?) compiles when the source is an array of values or of promises. Each call lowers to an async helper with the spec's loop: elements are awaited through the async-from-sync iterator, with the same microtask turns as a `for await` loop over an array, and a mapping function's result is awaited before it is stored. A throwing or rejecting mapping function and a rejected element close the iterator before the returned promise rejects, on the turn Node rejects it. Async generator sources, a thisArg, and arrays that mix values and promises are refused.