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

    Interface ZodTuple<T, Rest>

    interface ZodTuple<
        T extends TupleItems = readonly $ZodType[],
        Rest extends SomeType | null = $ZodType | null,
    > {
        _def: $ZodTupleDef<T, Rest>;
        _input: [
            ...TupleInputTypeWithOptionals<T>[],
            ...(Rest extends SomeType ? input<Rest<Rest>>[] : [])[],
        ];
        _output: [
            ...TupleOutputTypeWithOptionals<T>[],
            ...(Rest extends SomeType ? output<Rest<Rest>>[] : [])[],
        ];
        _zod: $ZodTupleInternals;
        "~standard": $ZodStandardSchema<ZodTuple<T, Rest>>;
        def: $ZodTupleDef<T, Rest>;
        description?: string;
        spa: (
            data: unknown,
            params?: ParseContext<$ZodIssue>,
        ) => Promise<
            ZodSafeParseResult<
                [
                    ...TupleOutputTypeWithOptionals<T>[],
                    ...(Rest extends SomeType ? output<Rest<Rest>>[] : [])[],
                ],
            >,
        >;
        type: "tuple";
        and<T extends SomeType>(incoming: T): ZodIntersection<ZodTuple<T, Rest>, T>;
        array(): ZodArray<ZodTuple<T, Rest>>;
        brand<T extends PropertyKey = PropertyKey>(
            value?: T,
        ): PropertyKey extends T
            ? ZodTuple<T, Rest>
            : $ZodBranded<ZodTuple<T, Rest>, T>;
        catch(
            def: [
                ...TupleOutputTypeWithOptionals<T>[],
                ...(Rest extends SomeType ? output<Rest<Rest>>[] : [])[],
            ],
        ): ZodCatch<ZodTuple<T, Rest>>;
        catch(
            def: (
                ctx: $ZodCatchCtx,
            ) => [
                ...TupleOutputTypeWithOptionals<T>[],
                ...(Rest extends SomeType ? output<Rest<Rest>>[] : [])[],
            ],
        ): ZodCatch<ZodTuple<T, Rest>>;
        check(
            ...checks: (
                | CheckFn<
                    [
                        ...TupleOutputTypeWithOptionals<T>[],
                        ...(Rest extends SomeType ? output<Rest<Rest>>[] : [])[],
                    ],
                >
                | $ZodCheck<
                    [
                        ...TupleOutputTypeWithOptionals<T>[],
                        ...(Rest extends SomeType ? output<Rest<Rest>>[] : [])[],
                    ],
                >
            )[],
        ): this;
        clone(def?: $ZodTupleDef<T, Rest>, params?: { parent: boolean }): this;
        default(
            def: [
                ...TupleOutputTypeWithOptionals<T>[],
                ...(Rest extends SomeType ? output<Rest<Rest>>[] : [])[],
            ],
        ): ZodDefault<ZodTuple<T, Rest>>;
        default(
            def: () => NoUndefined<
                [
                    ...TupleOutputTypeWithOptionals<T>[],
                    ...(Rest extends SomeType ? output<Rest<Rest>>[] : [])[],
                ],
            >,
        ): ZodDefault<ZodTuple<T, Rest>>;
        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<ZodTuple<T, Rest>>;
        nullable(): ZodNullable<ZodTuple<T, Rest>>;
        nullish(): ZodOptional<ZodNullable<ZodTuple<T, Rest>>>;
        optional(): ZodOptional<ZodTuple<T, Rest>>;
        or<T extends SomeType>(option: T): ZodUnion<[ZodTuple<T, Rest>, T]>;
        overwrite(
            fn: (
                x: [
                    ...TupleOutputTypeWithOptionals<T>[],
                    ...(Rest extends SomeType ? output<Rest<Rest>>[] : [])[],
                ],
            ) => [
                ...TupleOutputTypeWithOptionals<T>[],
                ...(Rest extends SomeType ? output<Rest<Rest>>[] : [])[],
            ],
        ): this;
        parse(
            data: unknown,
            params?: ParseContext<$ZodIssue>,
        ): [
            ...TupleOutputTypeWithOptionals<T>[],
            ...(Rest extends SomeType ? output<Rest<Rest>>[] : [])[],
        ];
        parseAsync(
            data: unknown,
            params?: ParseContext<$ZodIssue>,
        ): Promise<
            [
                ...TupleOutputTypeWithOptionals<T>[],
                ...(Rest extends SomeType ? output<Rest<Rest>>[] : [])[],
            ],
        >;
        pipe<
            T extends
                $ZodType<
                    any,
                    [
                        ...TupleOutputTypeWithOptionals<T>[],
                        ...(Rest extends SomeType ? output<Rest<Rest>>[] : [])[],
                    ],
                    $ZodTypeInternals<
                        any,
                        [
                            ...TupleOutputTypeWithOptionals<T>[],
                            ...(Rest extends SomeType ? output<Rest<Rest>>[] : [])[],
                        ],
                    >,
                >,
        >(
            target:
                | T
                | $ZodType<
                    any,
                    [
                        ...TupleOutputTypeWithOptionals<T>[],
                        ...(Rest extends SomeType ? output<Rest<Rest>>[] : [])[],
                    ],
                    $ZodTypeInternals<
                        any,
                        [
                            ...TupleOutputTypeWithOptionals<T>[],
                            ...(Rest extends SomeType ? output<Rest<Rest>>[] : [])[],
                        ],
                    >,
                >,
        ): ZodPipe<ZodTuple<T, Rest>, T>;
        prefault(
            def: () => [
                ...TupleInputTypeWithOptionals<T>[],
                ...(Rest extends SomeType ? input<Rest<Rest>>[] : [])[],
            ],
        ): ZodPrefault<ZodTuple<T, Rest>>;
        prefault(
            def: [
                ...TupleInputTypeWithOptionals<T>[],
                ...(Rest extends SomeType ? input<Rest<Rest>>[] : [])[],
            ],
        ): ZodPrefault<ZodTuple<T, Rest>>;
        readonly(): ZodReadonly<ZodTuple<T, Rest>>;
        refine(
            check: (
                arg: [
                    ...TupleOutputTypeWithOptionals<T>[],
                    ...(Rest extends SomeType ? output<Rest<Rest>>[] : [])[],
                ],
            ) => 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: ZodTuple<T, Rest> extends R["_schema"]
                ? undefined extends R["_meta"]
                    ? [$replace<R["_meta"], R["_schema"] & ZodTuple<T, Rest>>?]
                    : [$replace<R["_meta"], R["_schema"] & ZodTuple<T, Rest>>]
                : ["Incompatible schema"],
        ): this;
        rest<
            Rest extends
                SomeType = $ZodType<
                unknown,
                unknown,
                $ZodTypeInternals<unknown, unknown>,
            >,
        >(
            rest: Rest,
        ): ZodTuple<T, Rest>;
        safeParse(
            data: unknown,
            params?: ParseContext<$ZodIssue>,
        ): ZodSafeParseResult<
            [
                ...TupleOutputTypeWithOptionals<T>[],
                ...(Rest extends SomeType ? output<Rest<Rest>>[] : [])[],
            ],
        >;
        safeParseAsync(
            data: unknown,
            params?: ParseContext<$ZodIssue>,
        ): Promise<
            ZodSafeParseResult<
                [
                    ...TupleOutputTypeWithOptionals<T>[],
                    ...(Rest extends SomeType ? output<Rest<Rest>>[] : [])[],
                ],
            >,
        >;
        superRefine(
            refinement: (
                arg: [
                    ...TupleOutputTypeWithOptionals<T>[],
                    ...(Rest extends SomeType ? output<Rest<Rest>>[] : [])[],
                ],
                ctx: RefinementCtx<
                    [
                        ...TupleOutputTypeWithOptionals<T>[],
                        ...(Rest extends SomeType ? output<Rest<Rest>>[] : [])[],
                    ],
                >,
            ) => void | Promise<void>,
        ): this;
        transform<NewOut>(
            transform: (
                arg: [
                    ...TupleOutputTypeWithOptionals<T>[],
                    ...(Rest extends SomeType ? output<Rest<Rest>>[] : [])[],
                ],
                ctx: RefinementCtx<
                    [
                        ...TupleOutputTypeWithOptionals<T>[],
                        ...(Rest extends SomeType ? output<Rest<Rest>>[] : [])[],
                    ],
                >,
            ) => NewOut | Promise<NewOut>,
        ): ZodPipe<
            ZodTuple<T, Rest>,
            ZodTransform<
                Awaited<NewOut>,
                [
                    ...TupleOutputTypeWithOptionals<T>[],
                    ...(Rest extends SomeType ? output<Rest<Rest>>[] : [])[],
                ],
            >,
        >;
    }

    Type Parameters

    Hierarchy (View Summary)

    Index

    Properties

    Use .def instead.

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

    Use z.input<typeof schema> instead.

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

    Use z.output<typeof schema> instead.

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

    Methods

    • Parameters

      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

    • Type Parameters

      Parameters

      Returns this

    • Type Parameters

      • Rest extends SomeType = $ZodType<unknown, unknown, $ZodTypeInternals<unknown, unknown>>

      Parameters

      Returns ZodTuple<T, Rest>