zod
Version:
Typescript-first schema declaration and validation library with static type inference
17 lines (16 loc) • 683 B
TypeScript
import * as z from './base';
import { ZodUndefined } from './undefined';
import { ZodNull } from './null';
export interface ZodUnionDef<T extends [z.ZodAny, ...z.ZodAny[]] = [z.ZodAny, ...z.ZodAny[]]> extends z.ZodTypeDef {
t: z.ZodTypes.union;
options: T;
}
export declare class ZodUnion<T extends [z.ZodAny, z.ZodAny, ...z.ZodAny[]]> extends z.ZodType<T[number]['_type'], ZodUnionDef<T>> {
optional: () => ZodUnion<[this, ZodUndefined]>;
nullable: () => ZodUnion<[this, ZodNull]>;
toJSON: () => {
t: z.ZodTypes.union;
options: object[];
};
static create: <T_1 extends [z.ZodAny, z.ZodAny, ...z.ZodAny[]]>(types: T_1) => ZodUnion<T_1>;
}