Solid · API
createStream
Creates a stream from a Zod schema and an optional initial value. The current value starts as the initial value and is overwritten field by field as the reply is parsed, so a complete value is available to render before the first chunk arrives. Throws if initial does not validate against the schema.
z.object({
show: z.string(),
night: z.string(),
seats: z.array(z.string()),
price_cents: z.number(),
why: z.string(),
}){
show: '',
night: '',
seats: [],
price_cents: 0,
why: 'Still looking.',
}Stream, chunk by chunk
{"show":"The Tempest",{
show: 'The Tempest',
night: '',
seats: [],
price_cents: 0,
why: 'Still looking.',
}Runs in this page on the installed package. The input and the expected output are defined by the example.