Solid · API

stream.current

Returns the current value of the stream: the partial value parsed so far. It can be called at any time, and every field of the initial value is present with as much of its content as has been received. In the example the reply text is not valid JSON until its last chunk, and current() returns a value after every chunk.

Schema
z.object({
  show: z.string(),
  night: z.string(),
  seats: z.array(z.string()),
  price_cents: z.number(),
  why: z.string(),
})
Stream, chunk by chunk
Reply so far
{"show":"The Tempest","night":"2026-
JSON validity and current()
{
  validJson: false,
  current: {
    show: 'The Tempest',
    night: '2026-',
    seats: [],
    price_cents: 0,
    why: '',
  },
}
Output matches the expected value

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