mirror of
https://github.com/vercel-labs/scriptc.git
synced 2026-10-29 07:04:09 +08:00
An async generator that fell off its end, with a return type other than void, settled its last next() one microtask turn after Node, so for await loops over it also ended a turn late. The appended implicit return now marks the completion as settled, like a bare `return;`. return() at a suspended yield ran the generator's finally blocks before awaiting the return value. The request now awaits the value first and resumes the body on the next turn, and the completion that follows settles without a further turn, also when a finally block yields or awaits first. An explicit `return x` reached during that unwind still takes its own turn to await x. Array.fromAsync accepts typed async generator sources: each next() result is awaited and its value used as is, a throwing or rejecting mapping function closes the generator, and a rejected next() rejects the result on the turn Node rejects it.