Solid · Completion

Array item completion

An array item is complete when the next item opens, and the last item when the array closes: the rule for fields, applied by index. In the example nights.0 is complete and can be used while nights.1 is still streaming.

Schema
z.object({
  nights: z.array(z.object({ night: z.string(), title: z.string() })),
})
Listeners
for (const item of ['nights.0', 'nights.1', 'nights.2'])
  stream.select(item).onFinal(() => completed.push(item))
Stream, chunk by chunk
Reply so far
{"nights":[
{"night":"2026-10-23","title":"The Tempest"}
Completed items
[]
Output matches the expected value

Runs in this page on the installed package. The input and the expected output are defined by the example.