Solid · Errors

Strict mode

With mode: 'strict' the stream stops at the first value of the wrong type: the current value stays as it was before the chunk that contained it, nothing after it is parsed, and final() rejects. Use it for a reply that must be used whole or not at all, such as the amount charged for a pass.

Stream
createStream({
  schema: z.object({
    member: z.string(),
    amount_cents: z.number(),
    pass: z.string(),
  }),
  mode: 'strict',
})
Stream, chunk by chunk
Reply so far
{"member":"grace",
Value, error paths, final()
{
  value: { member: 'grace', amount_cents: 0, pass: '' },
  errorPaths: [],
  final: 'waiting',
}
Output matches the expected value

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