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.
z.object({
show: z.string(),
night: z.string(),
seats: z.array(z.string()),
price_cents: z.number(),
why: z.string(),
})Stream, chunk by chunk
{"show":"The Tempest","night":"2026-{
validJson: false,
current: {
show: 'The Tempest',
night: '2026-',
seats: [],
price_cents: 0,
why: '',
},
}Runs in this page on the installed package. The input and the expected output are defined by the example.