Skip to main content

Function: custom()

custom<O>(fn?, _params?): ZodCustom<O, O>

Defined in: packages/agentos/node_modules/zod/v4/classic/schemas.d.cts:784

Type Parameters​

O​

O

Parameters​

fn?​

(data) => unknown

_params?​

string |

{ abort?: boolean; error?: string | $ZodErrorMap<NonNullable<$ZodIssue>>; message?: string; params?: Record<string, any>; path?: PropertyKey[]; when?: (payload) => boolean; }

abort?​

boolean

If true, no later checks will be executed if this check fails. Default false.

error?​

string | $ZodErrorMap<NonNullable<$ZodIssue>>

message?​

string

Deprecated

This parameter is deprecated. Use error instead.

params?​

Record<string, any>

path?​

PropertyKey[]

when?​

(payload) => boolean

If provided, the check runs only when this returns true. By default, it is skipped if prior parsing produced aborting issues.

Returns​

ZodCustom<O, O>