bupkis
    Preparing search index...

    Interface ZodBoolean

    interface ZodBoolean {
        def: $ZodBooleanDef;
        type: "boolean";
        _def: $ZodBooleanDef;
        _output: boolean;
        _input: boolean;
        spa: (
            data: unknown,
            params?: ParseContext<$ZodIssue>,
        ) => Promise<ZodSafeParseResult<boolean>>;
        description?: string;
        _zod: $ZodBooleanInternals;
        "~standard": $ZodStandardSchema<z.ZodBoolean>;
        check(...checks: (z.core.$ZodCheck<boolean> | CheckFn<boolean>)[]): this;
        clone(def?: $ZodBooleanDef, params?: { parent: boolean }): this;
        register<
            R extends
                $ZodRegistry<
                    MetadataType,
                    z.core.$ZodType<unknown, unknown, $ZodTypeInternals<unknown, unknown>>,
                >,
        >(
            registry: R,
            ...meta: z.ZodBoolean extends R["_schema"]
                ? undefined extends R["_meta"]
                    ? [$replace<R["_meta"], R["_schema"] & z.ZodBoolean>?]
                    : [$replace<R["_meta"], R["_schema"] & z.ZodBoolean>]
                : ["Incompatible schema"],
        ): this;
        brand<T extends PropertyKey = PropertyKey>(
            value?: T,
        ): PropertyKey extends T ? z.ZodBoolean : $ZodBranded<z.ZodBoolean, T>;
        parse(data: unknown, params?: ParseContext<$ZodIssue>): boolean;
        safeParse(
            data: unknown,
            params?: ParseContext<$ZodIssue>,
        ): ZodSafeParseResult<boolean>;
        parseAsync(
            data: unknown,
            params?: ParseContext<$ZodIssue>,
        ): Promise<boolean>;
        safeParseAsync(
            data: unknown,
            params?: ParseContext<$ZodIssue>,
        ): Promise<ZodSafeParseResult<boolean>>;
        encode(data: boolean, params?: ParseContext<$ZodIssue>): boolean;
        decode(data: boolean, params?: ParseContext<$ZodIssue>): boolean;
        encodeAsync(
            data: boolean,
            params?: ParseContext<$ZodIssue>,
        ): Promise<boolean>;
        decodeAsync(
            data: boolean,
            params?: ParseContext<$ZodIssue>,
        ): Promise<boolean>;
        safeEncode(
            data: boolean,
            params?: ParseContext<$ZodIssue>,
        ): ZodSafeParseResult<boolean>;
        safeDecode(
            data: boolean,
            params?: ParseContext<$ZodIssue>,
        ): ZodSafeParseResult<boolean>;
        safeEncodeAsync(
            data: boolean,
            params?: ParseContext<$ZodIssue>,
        ): Promise<ZodSafeParseResult<boolean>>;
        safeDecodeAsync(
            data: boolean,
            params?: ParseContext<$ZodIssue>,
        ): Promise<ZodSafeParseResult<boolean>>;
        refine(
            check: (arg: boolean) => unknown,
            params?:
                | string
                | {
                    abort?: boolean;
                    when?: (payload: ParsePayload) => boolean;
                    path?: PropertyKey[];
                    params?: Record<string, any>;
                    error?: string | $ZodErrorMap<NonNullable<$ZodIssue>>;
                    message?: string;
                },
        ): this;
        superRefine(
            refinement: (
                arg: boolean,
                ctx: $RefinementCtx<boolean>,
            ) => void | Promise<void>,
        ): this;
        overwrite(fn: (x: boolean) => boolean): this;
        optional(): z.ZodOptional<z.ZodBoolean>;
        nonoptional(
            params?:
                | string
                | {
                    error?: string
                    | $ZodErrorMap<$ZodIssueInvalidType<unknown>>;
                    message?: string;
                },
        ): z.ZodNonOptional<z.ZodBoolean>;
        nullable(): z.ZodNullable<z.ZodBoolean>;
        nullish(): z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
        default(def: boolean): z.ZodDefault<z.ZodBoolean>;
        default(def: () => boolean): z.ZodDefault<z.ZodBoolean>;
        prefault(def: () => boolean): z.ZodPrefault<z.ZodBoolean>;
        prefault(def: boolean): z.ZodPrefault<z.ZodBoolean>;
        array(): z.ZodArray<z.ZodBoolean>;
        or<T extends SomeType>(option: T): z.ZodUnion<[z.ZodBoolean, T]>;
        and<T extends SomeType>(incoming: T): z.ZodIntersection<z.ZodBoolean, T>;
        transform<NewOut>(
            transform: (
                arg: boolean,
                ctx: $RefinementCtx<boolean>,
            ) => NewOut | Promise<NewOut>,
        ): z.ZodPipe<z.ZodBoolean, z.ZodTransform<Awaited<NewOut>, boolean>>;
        catch(def: boolean): z.ZodCatch<z.ZodBoolean>;
        catch(def: (ctx: $ZodCatchCtx) => boolean): z.ZodCatch<z.ZodBoolean>;
        pipe<
            T extends
                z.core.$ZodType<any, boolean, $ZodTypeInternals<any, boolean>>,
        >(
            target:
                | T
                | z.core.$ZodType<any, boolean, $ZodTypeInternals<any, boolean>>,
        ): z.ZodPipe<z.ZodBoolean, T>;
        readonly(): z.ZodReadonly<z.ZodBoolean>;
        describe(description: string): this;
        meta(): | undefined
        | {
            id?: string;
            title?: string;
            description?: string;
            deprecated?: boolean;
            [key: string]: unknown;
        };
        meta(
            data: {
                id?: string;
                title?: string;
                description?: string;
                deprecated?: boolean;
                [key: string]: unknown;
            },
        ): this;
        isOptional(): boolean;
        isNullable(): boolean;
    }

    Hierarchy (View Summary)

    Index

    Properties

    type: "boolean"

    Use .def instead.

    _output: boolean

    Use z.output<typeof schema> instead.

    _input: boolean

    Use z.input<typeof schema> instead.

    spa: (
        data: unknown,
        params?: ParseContext<$ZodIssue>,
    ) => Promise<ZodSafeParseResult<boolean>>
    description?: string

    Methods

    • Parameters

      Returns this

    • Parameters

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

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

          • Optionalwhen?: (payload: ParsePayload) => boolean

            If provided, this check will only be executed if the function returns true. Defaults to payload => z.util.isAborted(payload).

          • Optionalpath?: PropertyKey[]
          • Optionalparams?: Record<string, any>
          • Optionalerror?: string | $ZodErrorMap<NonNullable<$ZodIssue>>
          • Optionalmessage?: string

            This parameter is deprecated. Use error instead.

      Returns this

    • Parameters

      Returns this

    • Parameters

      • fn: (x: boolean) => boolean

      Returns this

    • Returns a new instance that has been registered in z.globalRegistry with the specified description

      Parameters

      • description: string

      Returns this

    • Returns the metadata associated with this instance in z.globalRegistry

      Returns
          | undefined
          | {
              id?: string;
              title?: string;
              description?: string;
              deprecated?: boolean;
              [key: string]: unknown;
          }

    • Returns a new instance that has been registered in z.globalRegistry with the specified metadata

      Parameters

      • data: {
            id?: string;
            title?: string;
            description?: string;
            deprecated?: boolean;
            [key: string]: unknown;
        }

      Returns this

    • Returns boolean

      Try safe-parsing undefined (this is what isOptional does internally):

      const schema = z.string().optional();
      const isOptional = schema.safeParse(undefined).success; // true
    • Returns boolean

      Try safe-parsing null (this is what isNullable does internally):

      const schema = z.string().nullable();
      const isNullable = schema.safeParse(null).success; // true