Type Parameters

Hierarchy

Properties

_elementOutput: T["element"]["_output"]
_errorMessages: string[]
_extraErrorMessages: string[]
_issues: ZodIssue[]
_touched: boolean
_updatePath: ((newPath: ParsePath) => void)

Type declaration

    • (newPath: ParsePath): void
    • Internal

      Parameters

      • newPath: ParsePath

      Returns void

_walk: ((handler: ((f: MobxZodField<any>) => void)) => void)

Type declaration

decodeResult: SafeDecodeResult<unknown, T["_input"]>

The input converted from rawInput, e.g. for a number field, "01234" is converted to 1234

element: null | HTMLElement

The optional HTMLElement associated with the field. Typically set in frontend framework.

elements: readonly MapZodTypeToField<T["element"]>[]

The child fields of this field.

errorMessages: readonly string[]

Error messages associated with the field.

extraErrorMessages: readonly string[]

Extra error messages associated with the field, i.e. errors not from the schema. Extra error messages are merely for the user's infomration, and does not block submission by default. Extra errror messages are removed from the field once the input changes or the form is submitted.

form: MobxZodForm<ZodTypeAny>

The form containing the field.

formMeta: FormMeta

See FormMeta.

issues: readonly ZodIssue[]

Issues associated with this field.

length: number

The field array's length.

path: ParsePath

The path of the field. Only contains numbers for array indices and strings for object keys. For example, the first field a in items in { items: [{ a: 'text' }] } would be ['items', 0, 'a']

rawInput: unknown

The original input, e.g. from DOM string.

setExtraErrorMessages: ((e: string[]) => void)

Type declaration

    • (e: string[]): void
    • Parameters

      • e: string[]

      Returns void

setTouched: ((touched: boolean) => void)

Type declaration

    • (touched: boolean): void
    • Manually set whether the user has interacted with the field.

      Returns

      Parameters

      • touched: boolean

      Returns void

splice: ((start: number, deleteCount: number, values: T["element"]["_output"][], options?: InputSetActionOptions) => void)

Type declaration

    • (start: number, deleteCount: number, values: T["element"]["_output"][], options?: InputSetActionOptions): void
    • Array.splice for the field array. See MDN for more.

      Returns

      Parameters

      • start: number
      • deleteCount: number
      • values: T["element"]["_output"][]
      • Optional options: InputSetActionOptions

      Returns void

touched: boolean

Whether user has interacted with the field.

type: T

The Zod type associated with the field

uniqueId: string

An id uniquely identifies the field across the form. Useful for SSR and tracking array field elements.

Methods

Generated using TypeDoc