interface-forge - v2.5.0
    Preparing search index...

    Interface ZodPipe<A, B>

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

    Type Parameters

    Hierarchy (View Summary)

    Index

    Properties

    _def: $ZodPipeDef<A, B>

    Use .def instead.

    _input: input<A>

    Use z.input<typeof schema> instead.

    _output: output<B>

    Use z.output<typeof schema> instead.

    "~standard": $ZodStandardSchema<ZodPipe<A, B>>
    def: $ZodPipeDef<A, B>
    description?: string
    in: A
    out: B
    spa: (
        data: unknown,
        params?: ParseContext<$ZodIssue>,
    ) => Promise<ZodSafeParseResult<output<B>>>
    type: "pipe"

    Methods

    • Parameters

      • Optionaldef: $ZodPipeDef<A, B>
      • Optionalparams: { parent: boolean }

      Returns this

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

      Parameters

      • description: string

      Returns this

    • Returns boolean

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

      const schema = z.string().nullable();
      const isNullable = schema.safeParse(null).success; // true
    • 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 the metadata associated with this instance in z.globalRegistry

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

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

      Parameters

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

      Returns this

    • Parameters

      Returns this

    • Parameters

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

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

          • Optionalerror?: string | $ZodErrorMap<NonNullable<$ZodIssue>>
          • Optionalmessage?: string

            This parameter is deprecated. Use error instead.

          • Optionalparams?: Record<string, any>
          • Optionalpath?: PropertyKey[]

      Returns this

    • Type Parameters

      Parameters

      • registry: R
      • ...meta: ZodPipe<A, B> extends R["_schema"]
            ? undefined extends R["_meta"]
                ? [$replace<R["_meta"], R["_schema"] & ZodPipe<A, B>>?]
                : [$replace<R["_meta"], R["_schema"] & ZodPipe<A, B>>]
            : ["Incompatible schema"]

      Returns this

    • Parameters

      Returns this

      Use .check() instead.