InferData

The data type of a form: the input type of its schema.

The data type of a form whose schema is TSchema: the type of the values the schema accepts, which is the type of the form's values while the user edits them.

It is the schema's input, not its output. A schema that transforms '42' into 42 makes the field a string; a key with a default is optional; a schema that coerces its input, such as z.coerce.number(), accepts anything and makes the field unknown. A schema that does not declare its types, which the standard allows, makes the whole data type unknown.

Type parameters

NameDescription
TSchemaAny Standard Schema: zod, valibot, ArkType and others.

Example

const schema = z.object({ email: z.email(), age: z.string().transform(Number) })

const defaultValues: InferData<typeof schema> = { email: '', age: '' }

See also