interface MobxZodNullableField<T> {
    _errorMessages: string[];
    _extraErrorMessages: string[];
    _issues: ZodIssue[];
    _touched: boolean;
    _types: MobxZodOmittableFieldTypes<T>;
    _updatePath: ((newPath) => void);
    _walk: ((handler) => void);
    decodeResult: SafeDecodeResult<unknown, T["_input"]>;
    element: null | HTMLElement;
    errorMessages: readonly string[];
    extraErrorMessages: readonly string[];
    form: MobxZodForm<ZodTypeAny>;
    formMeta: FormMeta;
    innerField: undefined | MapZodTypeToField<T["_def"]["innerType"]>;
    issues: readonly ZodIssue[];
    path: ParsePath;
    rawInput: unknown;
    setExtraErrorMessages: ((e) => void);
    setTouched: ((touched) => void);
    touched: boolean;
    type: T;
    uniqueId: string;
    _onInputChange(): void;
    setOutput(output): void;
    setRawInput(value): void;
}

Type Parameters

Hierarchy (view full)

Properties

_errorMessages: string[]
_extraErrorMessages: string[]
_issues: ZodIssue[]
_touched: boolean
_updatePath: ((newPath) => void)

Type declaration

    • (newPath): void
    • Parameters

      • newPath: ParsePath

      Returns void

_walk: ((handler) => void)

Type declaration

    • (handler): void
    • Parameters

      • handler: ((f) => void)

      Returns void

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.

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.

innerField: undefined | MapZodTypeToField<T["_def"]["innerType"]>

If the input is null or undefined, innerField will be undefined; else, it will be the field that its inner type is mapped to. For ZodString and ZodNumber inner type, it is always not undefined, because null or undefined will be encoded to empty string.

issues: readonly ZodIssue[]

Issues associated with this field.

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) => void)

Type declaration

    • (e): void
    • Parameters

      • e: string[]

      Returns void

setTouched: ((touched) => void)

Manually set whether the user has interacted with the field.

Type declaration

    • (touched): void
    • Parameters

      • touched: boolean

      Returns void

Returns

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