Solid · Options

initial

Sets the value the stream starts from: each field keeps it until the reply reaches that field. When omitted, Solid derives one from the schema: an empty string, 0, false, an empty array, the first option of an enum, null for a nullable type. A schema that the derived value does not validate against requires an explicit initial.

Schema
z.object({
  member: z.string(),
  pass: z.enum(['season', 'none']),
  seats: z.array(z.string()),
  price_cents: z.number(),
  paid: z.boolean(),
  guest: z.string().nullable(),
})
Call
createStream({ schema }).current()
Derived initial value
{
  member: '',
  pass: 'season',
  seats: [],
  price_cents: 0,
  paid: false,
  guest: null,
}
Output matches the expected value

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