KC's Workspace
    Preparing search index...

    Interface ZodTuple<T, Rest>

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

    Type Parameters

    Hierarchy (View Summary)

    Index

    Use .def instead.

    _input: [
        ...TupleInputTypeWithOptionals<T>[],
        ...(Rest extends z.core.SomeType ? z.core.input<Rest>[] : [])[],
    ]

    Use z.input<typeof schema> instead.

    _output: [
        ...TupleOutputTypeWithOptionals<T>[],
        ...(Rest extends z.core.SomeType ? z.core.output<Rest>[] : [])[],
    ]

    Use z.output<typeof schema> instead.

    description?: string
    spa: (
        data: unknown,
        params?: ParseContext<$ZodIssue>,
    ) => Promise<
        ZodSafeParseResult<
            [
                ...TupleOutputTypeWithOptionals<T>[],
                ...(Rest extends z.core.SomeType ? z.core.output<Rest>[] : [])[],
            ],
        >,
    >
    type: "tuple"
    • Type Parameters

      • T

      Parameters

      • fn: (schema: this) => T

      Returns T

    • 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
          | {
              deprecated?: boolean;
              description?: string;
              id?: string;
              title?: string;
              [key: string]: unknown;
          }
          | undefined

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

      Parameters

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

      Returns this