Solid · Errors
Type mismatch
A value whose JSON type differs from the schema is detected at its first character: Solid skips the whole value, whatever its length, keeps the previous one and reports the mismatch through onError. Code that maps over seats or adds to price_cents never receives a value of the wrong type. In the example the reply has a number for night, an object for seats, a string for price_cents and null for why.
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",{
errors: [],
value: {
show: 'The Tempest',
night: '',
seats: [],
price_cents: 0,
why: '',
},
}Runs in this page on the installed package. The input and the expected output are defined by the example.