Skip to content

@jsvision/forms / CreateFormOptions

Interface: CreateFormOptions<S, I>

Defined in: types.ts:136

Options for createForm.

Type Parameters

S

S extends z.ZodObject<z.ZodRawShape>

the Zod object schema type.

I

I extends Record<keyof z.output<S>, unknown>

the raw initial values; keys constrained to the schema, value types are the raw editing types the caller supplies.

Properties

asyncDebounceMs?

optional asyncDebounceMs?: number

Defined in: types.ts:158

Debounce, in milliseconds, before an async validator runs after a change. Defaults to 300. Applies to every async field.


asyncValidators?

optional asyncValidators?: { [K in string | number | symbol]?: AsyncValidator<I[K]> }

Defined in: types.ts:153

Opt-in per-field async validators, keyed by field name. A field with an entry runs its validator debounced on change (only while the field is synchronously clean) and on submit; the field's validating() / asyncError() reflect the result. Fields with no entry are unaffected.


initial

initial: I

Defined in: types.ts:147

The raw initial editing values. Keys are constrained to the schema's keys; the value types are whatever the caller edits (e.g. a coerced-number field is initialised as a string).


schema

schema: S

Defined in: types.ts:141

A Zod object schema. A non-string field that is edited as text must use z.coerce.* (or a transform) so the raw string is coerced by the schema.