import { enumUtil } from "./helpers/enumUtil"; import { errorUtil } from "./helpers/errorUtil"; import { AsyncParseReturnType, ParseContext, ParseInput, ParseParams, ParseReturnType, ParseStatus, SyncParseReturnType } from "./helpers/parseUtil"; import { partialUtil } from "./helpers/partialUtil"; import { Primitive } from "./helpers/typeAliases"; import { objectUtil, util } from "./helpers/util"; import { IssueData, StringValidation, ZodCustomIssue, ZodError, ZodErrorMap } from "./ZodError"; export declare type RefinementCtx = { addIssue: (arg: IssueData) => void; path: (string | number)[]; }; export declare type ZodRawShape = { [k: string]: ZodTypeAny; }; export declare type ZodTypeAny = ZodType; export declare type TypeOf> = T["_output"]; export declare type input> = T["_input"]; export declare type output> = T["_output"]; export type { TypeOf as infer }; export declare type CustomErrorParams = Partial>; export interface ZodTypeDef { errorMap?: ZodErrorMap; description?: string; } export declare type RawCreateParams = { errorMap?: ZodErrorMap; invalid_type_error?: string; required_error?: string; description?: string; } | undefined; export declare type ProcessedCreateParams = { errorMap?: ZodErrorMap; description?: string; }; export declare type SafeParseSuccess = { success: true; data: Output; }; export declare type SafeParseError = { success: false; error: ZodError; }; export declare type SafeParseReturnType = SafeParseSuccess | SafeParseError; export declare abstract class ZodType { readonly _type: Output; readonly _output: Output; readonly _input: Input; readonly _def: Def; get description(): string | undefined; abstract _parse(input: ParseInput): ParseReturnType; _getType(input: ParseInput): string; _getOrReturnCtx(input: ParseInput, ctx?: ParseContext | undefined): ParseContext; _processInputParams(input: ParseInput): { status: ParseStatus; ctx: ParseContext; }; _parseSync(input: ParseInput): SyncParseReturnType; _parseAsync(input: ParseInput): AsyncParseReturnType; parse(data: unknown, params?: Partial): Output; safeParse(data: unknown, params?: Partial): SafeParseReturnType; parseAsync(data: unknown, params?: Partial): Promise; safeParseAsync(data: unknown, params?: Partial): Promise>; /** Alias of safeParseAsync */ spa: (data: unknown, params?: Partial | undefined) => Promise>; refine(check: (arg: Output) => arg is RefinedOutput, message?: string | CustomErrorParams | ((arg: Output) => CustomErrorParams)): ZodEffects; refine(check: (arg: Output) => unknown | Promise, message?: string | CustomErrorParams | ((arg: Output) => CustomErrorParams)): ZodEffects; refinement(check: (arg: Output) => arg is RefinedOutput, refinementData: IssueData | ((arg: Output, ctx: RefinementCtx) => IssueData)): ZodEffects; refinement(check: (arg: Output) => boolean, refinementData: IssueData | ((arg: Output, ctx: RefinementCtx) => IssueData)): ZodEffects; _refinement(refinement: RefinementEffect["refinement"]): ZodEffects; superRefine(refinement: (arg: Output, ctx: RefinementCtx) => arg is RefinedOutput): ZodEffects; superRefine(refinement: (arg: Output, ctx: RefinementCtx) => void): ZodEffects; superRefine(refinement: (arg: Output, ctx: RefinementCtx) => Promise): ZodEffects; constructor(def: Def); optional(): ZodOptional; nullable(): ZodNullable; nullish(): ZodOptional>; array(): ZodArray; promise(): ZodPromise; or(option: T): ZodUnion<[this, T]>; and(incoming: T): ZodIntersection; transform(transform: (arg: Output, ctx: RefinementCtx) => NewOut | Promise): ZodEffects; default(def: util.noUndefined): ZodDefault; default(def: () => util.noUndefined): ZodDefault; brand(brand?: B): ZodBranded; catch(def: Output): ZodCatch; catch(def: (ctx: { error: ZodError; input: Input; }) => Output): ZodCatch; describe(description: string): this; pipe(target: T): ZodPipeline; readonly(): ZodReadonly; isOptional(): boolean; isNullable(): boolean; } export declare type IpVersion = "v4" | "v6"; export declare type ZodStringCheck = { kind: "min"; value: number; message?: string; } | { kind: "max"; value: number; message?: string; } | { kind: "length"; value: number; message?: string; } | { kind: "email"; message?: string; } | { kind: "url"; message?: string; } | { kind: "emoji"; message?: string; } | { kind: "uuid"; message?: string; } | { kind: "cuid"; message?: string; } | { kind: "includes"; value: string; position?: number; message?: string; } | { kind: "cuid2"; message?: string; } | { kind: "ulid"; message?: string; } | { kind: "startsWith"; value: string; message?: string; } | { kind: "endsWith"; value: string; message?: string; } | { kind: "regex"; regex: RegExp; message?: string; } | { kind: "trim"; message?: string; } | { kind: "toLowerCase"; message?: string; } | { kind: "toUpperCase"; message?: string; } | { kind: "datetime"; offset: boolean; precision: number | null; message?: string; } | { kind: "ip"; version?: IpVersion; message?: string; }; export interface ZodStringDef extends ZodTypeDef { checks: ZodStringCheck[]; typeName: ZodFirstPartyTypeKind.ZodString; coerce: boolean; } export declare class ZodString extends ZodType { _parse(input: ParseInput): ParseReturnType; protected _regex(regex: RegExp, validation: StringValidation, message?: errorUtil.ErrMessage): ZodEffects; _addCheck(check: ZodStringCheck): ZodString; email(message?: errorUtil.ErrMessage): ZodString; url(message?: errorUtil.ErrMessage): ZodString; emoji(message?: errorUtil.ErrMessage): ZodString; uuid(message?: errorUtil.ErrMessage): ZodString; cuid(message?: errorUtil.ErrMessage): ZodString; cuid2(message?: errorUtil.ErrMessage): ZodString; ulid(message?: errorUtil.ErrMessage): ZodString; ip(options?: string | { version?: "v4" | "v6"; message?: string; }): ZodString; datetime(options?: string | { message?: string | undefined; precision?: number | null; offset?: boolean; }): ZodString; regex(regex: RegExp, message?: errorUtil.ErrMessage): ZodString; includes(value: string, options?: { message?: string; position?: number; }): ZodString; startsWith(value: string, message?: errorUtil.ErrMessage): ZodString; endsWith(value: string, message?: errorUtil.ErrMessage): ZodString; min(minLength: number, message?: errorUtil.ErrMessage): ZodString; max(maxLength: number, message?: errorUtil.ErrMessage): ZodString; length(len: number, message?: errorUtil.ErrMessage): ZodString; /** * @deprecated Use z.string().min(1) instead. * @see {@link ZodString.min} */ nonempty(message?: errorUtil.ErrMessage): ZodString; trim(): ZodString; toLowerCase(): ZodString; toUpperCase(): ZodString; get isDatetime(): boolean; get isEmail(): boolean; get isURL(): boolean; get isEmoji(): boolean; get isUUID(): boolean; get isCUID(): boolean; get isCUID2(): boolean; get isULID(): boolean; get isIP(): boolean; get minLength(): number | null; get maxLength(): number | null; static create: (params?: ({ errorMap?: ZodErrorMap | undefined; invalid_type_error?: string | undefined; required_error?: string | undefined; description?: string | undefined; } & { coerce?: true | undefined; }) | undefined) => ZodString; } export declare type ZodNumberCheck = { kind: "min"; value: number; inclusive: boolean; message?: string; } | { kind: "max"; value: number; inclusive: boolean; message?: string; } | { kind: "int"; message?: string; } | { kind: "multipleOf"; value: number; message?: string; } | { kind: "finite"; message?: string; }; export interface ZodNumberDef extends ZodTypeDef { checks: ZodNumberCheck[]; typeName: ZodFirstPartyTypeKind.ZodNumber; coerce: boolean; } export declare class ZodNumber extends ZodType { _parse(input: ParseInput): ParseReturnType; static create: (params?: ({ errorMap?: ZodErrorMap | undefined; invalid_type_error?: string | undefined; required_error?: string | undefined; description?: string | undefined; } & { coerce?: boolean | undefined; }) | undefined) => ZodNumber; gte(value: number, message?: errorUtil.ErrMessage): ZodNumber; min: (value: number, message?: errorUtil.ErrMessage | undefined) => ZodNumber; gt(value: number, message?: errorUtil.ErrMessage): ZodNumber; lte(value: number, message?: errorUtil.ErrMessage): ZodNumber; max: (value: number, message?: errorUtil.ErrMessage | undefined) => ZodNumber; lt(value: number, message?: errorUtil.ErrMessage): ZodNumber; protected setLimit(kind: "min" | "max", value: number, inclusive: boolean, message?: string): ZodNumber; _addCheck(check: ZodNumberCheck): ZodNumber; int(message?: errorUtil.ErrMessage): ZodNumber; positive(message?: errorUtil.ErrMessage): ZodNumber; negative(message?: errorUtil.ErrMessage): ZodNumber; nonpositive(message?: errorUtil.ErrMessage): ZodNumber; nonnegative(message?: errorUtil.ErrMessage): ZodNumber; multipleOf(value: number, message?: errorUtil.ErrMessage): ZodNumber; step: (value: number, message?: errorUtil.ErrMessage | undefined) => ZodNumber; finite(message?: errorUtil.ErrMessage): ZodNumber; safe(message?: errorUtil.ErrMessage): ZodNumber; get minValue(): number | null; get maxValue(): number | null; get isInt(): boolean; get isFinite(): boolean; } export declare type ZodBigIntCheck = { kind: "min"; value: bigint; inclusive: boolean; message?: string; } | { kind: "max"; value: bigint; inclusive: boolean; message?: string; } | { kind: "multipleOf"; value: bigint; message?: string; }; export interface ZodBigIntDef extends ZodTypeDef { checks: ZodBigIntCheck[]; typeName: ZodFirstPartyTypeKind.ZodBigInt; coerce: boolean; } export declare class ZodBigInt extends ZodType { _parse(input: ParseInput): ParseReturnType; static create: (params?: ({ errorMap?: ZodErrorMap | undefined; invalid_type_error?: string | undefined; required_error?: string | undefined; description?: string | undefined; } & { coerce?: boolean | undefined; }) | undefined) => ZodBigInt; gte(value: bigint, message?: errorUtil.ErrMessage): ZodBigInt; min: (value: bigint, message?: errorUtil.ErrMessage | undefined) => ZodBigInt; gt(value: bigint, message?: errorUtil.ErrMessage): ZodBigInt; lte(value: bigint, message?: errorUtil.ErrMessage): ZodBigInt; max: (value: bigint, message?: errorUtil.ErrMessage | undefined) => ZodBigInt; lt(value: bigint, message?: errorUtil.ErrMessage): ZodBigInt; protected setLimit(kind: "min" | "max", value: bigint, inclusive: boolean, message?: string): ZodBigInt; _addCheck(check: ZodBigIntCheck): ZodBigInt; positive(message?: errorUtil.ErrMessage): ZodBigInt; negative(message?: errorUtil.ErrMessage): ZodBigInt; nonpositive(message?: errorUtil.ErrMessage): ZodBigInt; nonnegative(message?: errorUtil.ErrMessage): ZodBigInt; multipleOf(value: bigint, message?: errorUtil.ErrMessage): ZodBigInt; get minValue(): bigint | null; get maxValue(): bigint | null; } export interface ZodBooleanDef extends ZodTypeDef { typeName: ZodFirstPartyTypeKind.ZodBoolean; coerce: boolean; } export declare class ZodBoolean extends ZodType { _parse(input: ParseInput): ParseReturnType; static create: (params?: ({ errorMap?: ZodErrorMap | undefined; invalid_type_error?: string | undefined; required_error?: string | undefined; description?: string | undefined; } & { coerce?: boolean | undefined; }) | undefined) => ZodBoolean; } export declare type ZodDateCheck = { kind: "min"; value: number; message?: string; } | { kind: "max"; value: number; message?: string; }; export interface ZodDateDef extends ZodTypeDef { checks: ZodDateCheck[]; coerce: boolean; typeName: ZodFirstPartyTypeKind.ZodDate; } export declare class ZodDate extends ZodType { _parse(input: ParseInput): ParseReturnType; _addCheck(check: ZodDateCheck): ZodDate; min(minDate: Date, message?: errorUtil.ErrMessage): ZodDate; max(maxDate: Date, message?: errorUtil.ErrMessage): ZodDate; get minDate(): Date | null; get maxDate(): Date | null; static create: (params?: ({ errorMap?: ZodErrorMap | undefined; invalid_type_error?: string | undefined; required_error?: string | undefined; description?: string | undefined; } & { coerce?: boolean | undefined; }) | undefined) => ZodDate; } export interface ZodSymbolDef extends ZodTypeDef { typeName: ZodFirstPartyTypeKind.ZodSymbol; } export declare class ZodSymbol extends ZodType { _parse(input: ParseInput): ParseReturnType; static create: (params?: RawCreateParams) => ZodSymbol; } export interface ZodUndefinedDef extends ZodTypeDef { typeName: ZodFirstPartyTypeKind.ZodUndefined; } export declare class ZodUndefined extends ZodType { _parse(input: ParseInput): ParseReturnType; params?: RawCreateParams; static create: (params?: RawCreateParams) => ZodUndefined; } export interface ZodNullDef extends ZodTypeDef { typeName: ZodFirstPartyTypeKind.ZodNull; } export declare class ZodNull extends ZodType { _parse(input: ParseInput): ParseReturnType; static create: (params?: RawCreateParams) => ZodNull; } export interface ZodAnyDef extends ZodTypeDef { typeName: ZodFirstPartyTypeKind.ZodAny; } export declare class ZodAny extends ZodType { _any: true; _parse(input: ParseInput): ParseReturnType; static create: (params?: RawCreateParams) => ZodAny; } export interface ZodUnknownDef extends ZodTypeDef { typeName: ZodFirstPartyTypeKind.ZodUnknown; } export declare class ZodUnknown extends ZodType { _unknown: true; _parse(input: ParseInput): ParseReturnType; static create: (params?: RawCreateParams) => ZodUnknown; } export interface ZodNeverDef extends ZodTypeDef { typeName: ZodFirstPartyTypeKind.ZodNever; } export declare class ZodNever extends ZodType { _parse(input: ParseInput): ParseReturnType; static create: (params?: RawCreateParams) => ZodNever; } export interface ZodVoidDef extends ZodTypeDef { typeName: ZodFirstPartyTypeKind.ZodVoid; } export declare class ZodVoid extends ZodType { _parse(input: ParseInput): ParseReturnType; static create: (params?: RawCreateParams) => ZodVoid; } export interface ZodArrayDef extends ZodTypeDef { type: T; typeName: ZodFirstPartyTypeKind.ZodArray; exactLength: { value: number; message?: string; } | null; minLength: { value: number; message?: string; } | null; maxLength: { value: number; message?: string; } | null; } export declare type ArrayCardinality = "many" | "atleastone"; export declare type arrayOutputType = Cardinality extends "atleastone" ? [T["_output"], ...T["_output"][]] : T["_output"][]; export declare class ZodArray extends ZodType, ZodArrayDef, Cardinality extends "atleastone" ? [T["_input"], ...T["_input"][]] : T["_input"][]> { _parse(input: ParseInput): ParseReturnType; get element(): T; min(minLength: number, message?: errorUtil.ErrMessage): this; max(maxLength: number, message?: errorUtil.ErrMessage): this; length(len: number, message?: errorUtil.ErrMessage): this; nonempty(message?: errorUtil.ErrMessage): ZodArray; static create: (schema: T_1, params?: RawCreateParams) => ZodArray; } export declare type ZodNonEmptyArray = ZodArray; export declare type UnknownKeysParam = "passthrough" | "strict" | "strip"; export interface ZodObjectDef extends ZodTypeDef { typeName: ZodFirstPartyTypeKind.ZodObject; shape: () => T; catchall: Catchall; unknownKeys: UnknownKeys; } export declare type mergeTypes = { [k in keyof A | keyof B]: k extends keyof B ? B[k] : k extends keyof A ? A[k] : never; }; export declare type objectOutputType = objectUtil.flatten>> & CatchallOutput & PassthroughType; export declare type baseObjectOutputType = { [k in keyof Shape]: Shape[k]["_output"]; }; export declare type objectInputType = objectUtil.flatten> & CatchallInput & PassthroughType; export declare type baseObjectInputType = objectUtil.addQuestionMarks<{ [k in keyof Shape]: Shape[k]["_input"]; }>; export declare type CatchallOutput = ZodTypeAny extends T ? unknown : { [k: string]: T["_output"]; }; export declare type CatchallInput = ZodTypeAny extends T ? unknown : { [k: string]: T["_input"]; }; export declare type PassthroughType = T extends "passthrough" ? { [k: string]: unknown; } : unknown; export declare type deoptional = T extends ZodOptional ? deoptional : T extends ZodNullable ? ZodNullable> : T; export declare type SomeZodObject = ZodObject; export declare type noUnrecognized = { [k in keyof Obj]: k extends keyof Shape ? Obj[k] : never; }; export declare class ZodObject, Input = objectInputType> extends ZodType, Input> { private _cached; _getCached(): { shape: T; keys: string[]; }; _parse(input: ParseInput): ParseReturnType; get shape(): T; strict(message?: errorUtil.ErrMessage): ZodObject; strip(): ZodObject; passthrough(): ZodObject; /** * @deprecated In most cases, this is no longer needed - unknown properties are now silently stripped. * If you want to pass through unknown properties, use `.passthrough()` instead. */ nonstrict: () => ZodObject; extend(augmentation: Augmentation): ZodObject, UnknownKeys, Catchall>; /** * @deprecated Use `.extend` instead * */ augment: (augmentation: Augmentation) => ZodObject<{ [k in keyof (Omit & Augmentation)]: (Omit & Augmentation)[k]; }, UnknownKeys, Catchall, objectOutputType<{ [k in keyof (Omit & Augmentation)]: (Omit & Augmentation)[k]; }, Catchall, UnknownKeys>, objectInputType<{ [k in keyof (Omit & Augmentation)]: (Omit & Augmentation)[k]; }, Catchall, UnknownKeys>>; /** * Prior to zod@1.0.12 there was a bug in the * inferred type of merged objects. Please * upgrade if you are experiencing issues. */ merge(merging: Incoming): ZodObject, Incoming["_def"]["unknownKeys"], Incoming["_def"]["catchall"]>; setKey(key: Key, schema: Schema): ZodObject; catchall(index: Index): ZodObject; pick(mask: Mask): ZodObject>, UnknownKeys, Catchall>; omit(mask: Mask): ZodObject, UnknownKeys, Catchall>; /** * @deprecated */ deepPartial(): partialUtil.DeepPartial; partial(): ZodObject<{ [k in keyof T]: ZodOptional; }, UnknownKeys, Catchall>; partial(mask: Mask): ZodObject : T[k]; }>, UnknownKeys, Catchall>; required(): ZodObject<{ [k in keyof T]: deoptional; }, UnknownKeys, Catchall>; required(mask: Mask): ZodObject : T[k]; }>, UnknownKeys, Catchall>; keyof(): ZodEnum>; static create: (shape: T_1, params?: RawCreateParams) => ZodObject, { [k in keyof baseObjectOutputType]: undefined extends baseObjectOutputType[k] ? never : k; }[keyof T_1]>]: objectUtil.addQuestionMarks, { [k in keyof baseObjectOutputType]: undefined extends baseObjectOutputType[k] ? never : k; }[keyof T_1]>[k_1]; }, { [k_2 in keyof baseObjectInputType]: baseObjectInputType[k_2]; }>; static strictCreate: (shape: T_1, params?: RawCreateParams) => ZodObject, { [k in keyof baseObjectOutputType]: undefined extends baseObjectOutputType[k] ? never : k; }[keyof T_1]>]: objectUtil.addQuestionMarks, { [k in keyof baseObjectOutputType]: undefined extends baseObjectOutputType[k] ? never : k; }[keyof T_1]>[k_1]; }, { [k_2 in keyof baseObjectInputType]: baseObjectInputType[k_2]; }>; static lazycreate: (shape: () => T_1, params?: RawCreateParams) => ZodObject, { [k in keyof baseObjectOutputType]: undefined extends baseObjectOutputType[k] ? never : k; }[keyof T_1]>]: objectUtil.addQuestionMarks, { [k in keyof baseObjectOutputType]: undefined extends baseObjectOutputType[k] ? never : k; }[keyof T_1]>[k_1]; }, { [k_2 in keyof baseObjectInputType]: baseObjectInputType[k_2]; }>; } export declare type AnyZodObject = ZodObject; export declare type ZodUnionOptions = Readonly<[ZodTypeAny, ...ZodTypeAny[]]>; export interface ZodUnionDef> extends ZodTypeDef { options: T; typeName: ZodFirstPartyTypeKind.ZodUnion; } export declare class ZodUnion extends ZodType, T[number]["_input"]> { _parse(input: ParseInput): ParseReturnType; get options(): T; static create: (types: T_1, params?: RawCreateParams) => ZodUnion; } export declare type ZodDiscriminatedUnionOption = ZodObject<{ [key in Discriminator]: ZodTypeAny; } & ZodRawShape, UnknownKeysParam, ZodTypeAny>; export interface ZodDiscriminatedUnionDef[] = ZodDiscriminatedUnionOption[]> extends ZodTypeDef { discriminator: Discriminator; options: Options; optionsMap: Map>; typeName: ZodFirstPartyTypeKind.ZodDiscriminatedUnion; } export declare class ZodDiscriminatedUnion[]> extends ZodType, ZodDiscriminatedUnionDef, input> { _parse(input: ParseInput): ParseReturnType; get discriminator(): Discriminator; get options(): Options; get optionsMap(): Map>; /** * The constructor of the discriminated union schema. Its behaviour is very similar to that of the normal z.union() constructor. * However, it only allows a union of objects, all of which need to share a discriminator property. This property must * have a different value for each object in the union. * @param discriminator the name of the discriminator property * @param types an array of object schemas * @param params */ static create, ...ZodDiscriminatedUnionOption[] ]>(discriminator: Discriminator, options: Types, params?: RawCreateParams): ZodDiscriminatedUnion; } export interface ZodIntersectionDef extends ZodTypeDef { left: T; right: U; typeName: ZodFirstPartyTypeKind.ZodIntersection; } export declare class ZodIntersection extends ZodType, T["_input"] & U["_input"]> { _parse(input: ParseInput): ParseReturnType; static create: (left: T_1, right: U_1, params?: RawCreateParams) => ZodIntersection; } export declare type ZodTupleItems = [ZodTypeAny, ...ZodTypeAny[]]; export declare type AssertArray = T extends any[] ? T : never; export declare type OutputTypeOfTuple = AssertArray<{ [k in keyof T]: T[k] extends ZodType ? T[k]["_output"] : never; }>; export declare type OutputTypeOfTupleWithRest = Rest extends ZodTypeAny ? [...OutputTypeOfTuple, ...Rest["_output"][]] : OutputTypeOfTuple; export declare type InputTypeOfTuple = AssertArray<{ [k in keyof T]: T[k] extends ZodType ? T[k]["_input"] : never; }>; export declare type InputTypeOfTupleWithRest = Rest extends ZodTypeAny ? [...InputTypeOfTuple, ...Rest["_input"][]] : InputTypeOfTuple; export interface ZodTupleDef extends ZodTypeDef { items: T; rest: Rest; typeName: ZodFirstPartyTypeKind.ZodTuple; } export declare type AnyZodTuple = ZodTuple<[ ZodTypeAny, ...ZodTypeAny[] ] | [], ZodTypeAny | null>; export declare class ZodTuple extends ZodType, ZodTupleDef, InputTypeOfTupleWithRest> { _parse(input: ParseInput): ParseReturnType; get items(): T; rest(rest: Rest): ZodTuple; static create: (schemas: T_1, params?: RawCreateParams) => ZodTuple; } export interface ZodRecordDef extends ZodTypeDef { valueType: Value; keyType: Key; typeName: ZodFirstPartyTypeKind.ZodRecord; } export declare type KeySchema = ZodType; export declare type RecordType = [ string ] extends [K] ? Record : [number] extends [K] ? Record : [symbol] extends [K] ? Record : [BRAND] extends [K] ? Record : Partial>; export declare class ZodRecord extends ZodType, ZodRecordDef, RecordType> { get keySchema(): Key; get valueSchema(): Value; _parse(input: ParseInput): ParseReturnType; get element(): Value; static create(valueType: Value, params?: RawCreateParams): ZodRecord; static create(keySchema: Keys, valueType: Value, params?: RawCreateParams): ZodRecord; } export interface ZodMapDef extends ZodTypeDef { valueType: Value; keyType: Key; typeName: ZodFirstPartyTypeKind.ZodMap; } export declare class ZodMap extends ZodType, ZodMapDef, Map> { get keySchema(): Key; get valueSchema(): Value; _parse(input: ParseInput): ParseReturnType; static create: (keyType: Key_1, valueType: Value_1, params?: RawCreateParams) => ZodMap; } export interface ZodSetDef extends ZodTypeDef { valueType: Value; typeName: ZodFirstPartyTypeKind.ZodSet; minSize: { value: number; message?: string; } | null; maxSize: { value: number; message?: string; } | null; } export declare class ZodSet extends ZodType, ZodSetDef, Set> { _parse(input: ParseInput): ParseReturnType; min(minSize: number, message?: errorUtil.ErrMessage): this; max(maxSize: number, message?: errorUtil.ErrMessage): this; size(size: number, message?: errorUtil.ErrMessage): this; nonempty(message?: errorUtil.ErrMessage): ZodSet; static create: (valueType: Value_1, params?: RawCreateParams) => ZodSet; } export interface ZodFunctionDef = ZodTuple, Returns extends ZodTypeAny = ZodTypeAny> extends ZodTypeDef { args: Args; returns: Returns; typeName: ZodFirstPartyTypeKind.ZodFunction; } export declare type OuterTypeOfFunction, Returns extends ZodTypeAny> = Args["_input"] extends Array ? (...args: Args["_input"]) => Returns["_output"] : never; export declare type InnerTypeOfFunction, Returns extends ZodTypeAny> = Args["_output"] extends Array ? (...args: Args["_output"]) => Returns["_input"] : never; export declare class ZodFunction, Returns extends ZodTypeAny> extends ZodType, ZodFunctionDef, InnerTypeOfFunction> { _parse(input: ParseInput): ParseReturnType; parameters(): Args; returnType(): Returns; args[0]>(...items: Items): ZodFunction, Returns>; returns>(returnType: NewReturnType): ZodFunction; implement>(func: F): ReturnType extends Returns["_output"] ? (...args: Args["_input"]) => ReturnType : OuterTypeOfFunction; strictImplement(func: InnerTypeOfFunction): InnerTypeOfFunction; validate: >(func: F) => ReturnType extends Returns["_output"] ? (...args: Args["_input"]) => ReturnType : OuterTypeOfFunction; static create(): ZodFunction, ZodUnknown>; static create>(args: T): ZodFunction; static create(args: T, returns: U): ZodFunction; static create, U extends ZodTypeAny = ZodUnknown>(args: T, returns: U, params?: RawCreateParams): ZodFunction; } export interface ZodLazyDef extends ZodTypeDef { getter: () => T; typeName: ZodFirstPartyTypeKind.ZodLazy; } export declare class ZodLazy extends ZodType, ZodLazyDef, input> { get schema(): T; _parse(input: ParseInput): ParseReturnType; static create: (getter: () => T_1, params?: RawCreateParams) => ZodLazy; } export interface ZodLiteralDef extends ZodTypeDef { value: T; typeName: ZodFirstPartyTypeKind.ZodLiteral; } export declare class ZodLiteral extends ZodType> { _parse(input: ParseInput): ParseReturnType; get value(): T; static create: (value: T_1, params?: RawCreateParams) => ZodLiteral; } export declare type ArrayKeys = keyof any[]; export declare type Indices = Exclude; export declare type EnumValues = [string, ...string[]]; export declare type Values = { [k in T[number]]: k; }; export interface ZodEnumDef extends ZodTypeDef { values: T; typeName: ZodFirstPartyTypeKind.ZodEnum; } export declare type Writeable = { -readonly [P in keyof T]: T[P]; }; export declare type FilterEnum = Values extends [] ? [] : Values extends [infer Head, ...infer Rest] ? Head extends ToExclude ? FilterEnum : [Head, ...FilterEnum] : never; export declare type typecast = A extends T ? A : never; declare function createZodEnum>(values: T, params?: RawCreateParams): ZodEnum>; declare function createZodEnum(values: T, params?: RawCreateParams): ZodEnum; export declare class ZodEnum extends ZodType> { _parse(input: ParseInput): ParseReturnType; get options(): T; get enum(): Values; get Values(): Values; get Enum(): Values; extract(values: ToExtract): ZodEnum>; exclude(values: ToExclude): ZodEnum>, [string, ...string[]]>>; static create: typeof createZodEnum; } export interface ZodNativeEnumDef extends ZodTypeDef { values: T; typeName: ZodFirstPartyTypeKind.ZodNativeEnum; } export declare type EnumLike = { [k: string]: string | number; [nu: number]: string; }; export declare class ZodNativeEnum extends ZodType> { _parse(input: ParseInput): ParseReturnType; get enum(): T; static create: (values: T_1, params?: RawCreateParams) => ZodNativeEnum; } export interface ZodPromiseDef extends ZodTypeDef { type: T; typeName: ZodFirstPartyTypeKind.ZodPromise; } export declare class ZodPromise extends ZodType, ZodPromiseDef, Promise> { unwrap(): T; _parse(input: ParseInput): ParseReturnType; static create: (schema: T_1, params?: RawCreateParams) => ZodPromise; } export declare type Refinement = (arg: T, ctx: RefinementCtx) => any; export declare type SuperRefinement = (arg: T, ctx: RefinementCtx) => void | Promise; export declare type RefinementEffect = { type: "refinement"; refinement: (arg: T, ctx: RefinementCtx) => any; }; export declare type TransformEffect = { type: "transform"; transform: (arg: T, ctx: RefinementCtx) => any; }; export declare type PreprocessEffect = { type: "preprocess"; transform: (arg: T, ctx: RefinementCtx) => any; }; export declare type Effect = RefinementEffect | TransformEffect | PreprocessEffect; export interface ZodEffectsDef extends ZodTypeDef { schema: T; typeName: ZodFirstPartyTypeKind.ZodEffects; effect: Effect; } export declare class ZodEffects, Input = input> extends ZodType, Input> { innerType(): T; sourceType(): T; _parse(input: ParseInput): ParseReturnType; static create: (schema: I, effect: Effect, params?: RawCreateParams) => ZodEffects>; static createWithPreprocess: (preprocess: (arg: unknown, ctx: RefinementCtx) => unknown, schema: I, params?: RawCreateParams) => ZodEffects; } export { ZodEffects as ZodTransformer }; export interface ZodOptionalDef extends ZodTypeDef { innerType: T; typeName: ZodFirstPartyTypeKind.ZodOptional; } export declare type ZodOptionalType = ZodOptional; export declare class ZodOptional extends ZodType, T["_input"] | undefined> { _parse(input: ParseInput): ParseReturnType; unwrap(): T; static create: (type: T_1, params?: RawCreateParams) => ZodOptional; } export interface ZodNullableDef extends ZodTypeDef { innerType: T; typeName: ZodFirstPartyTypeKind.ZodNullable; } export declare type ZodNullableType = ZodNullable; export declare class ZodNullable extends ZodType, T["_input"] | null> { _parse(input: ParseInput): ParseReturnType; unwrap(): T; static create: (type: T_1, params?: RawCreateParams) => ZodNullable; } export interface ZodDefaultDef extends ZodTypeDef { innerType: T; defaultValue: () => util.noUndefined; typeName: ZodFirstPartyTypeKind.ZodDefault; } export declare class ZodDefault extends ZodType, ZodDefaultDef, T["_input"] | undefined> { _parse(input: ParseInput): ParseReturnType; removeDefault(): T; static create: (type: T_1, params: { errorMap?: ZodErrorMap | undefined; invalid_type_error?: string | undefined; required_error?: string | undefined; description?: string | undefined; } & { default: T_1["_input"] | (() => util.noUndefined); }) => ZodDefault; } export interface ZodCatchDef extends ZodTypeDef { innerType: T; catchValue: (ctx: { error: ZodError; input: unknown; }) => T["_input"]; typeName: ZodFirstPartyTypeKind.ZodCatch; } export declare class ZodCatch extends ZodType, unknown> { _parse(input: ParseInput): ParseReturnType; removeCatch(): T; static create: (type: T_1, params: { errorMap?: ZodErrorMap | undefined; invalid_type_error?: string | undefined; required_error?: string | undefined; description?: string | undefined; } & { catch: T_1["_output"] | (() => T_1["_output"]); }) => ZodCatch; } export interface ZodNaNDef extends ZodTypeDef { typeName: ZodFirstPartyTypeKind.ZodNaN; } export declare class ZodNaN extends ZodType { _parse(input: ParseInput): ParseReturnType; static create: (params?: RawCreateParams) => ZodNaN; } export interface ZodBrandedDef extends ZodTypeDef { type: T; typeName: ZodFirstPartyTypeKind.ZodBranded; } export declare const BRAND: unique symbol; export declare type BRAND = { [BRAND]: { [k in T]: true; }; }; export declare class ZodBranded extends ZodType, ZodBrandedDef, T["_input"]> { _parse(input: ParseInput): ParseReturnType; unwrap(): T; } export interface ZodPipelineDef extends ZodTypeDef { in: A; out: B; typeName: ZodFirstPartyTypeKind.ZodPipeline; } export declare class ZodPipeline extends ZodType, A["_input"]> { _parse(input: ParseInput): ParseReturnType; static create(a: A, b: B): ZodPipeline; } declare type BuiltIn = (((...args: any[]) => any) | (new (...args: any[]) => any)) | { readonly [Symbol.toStringTag]: string; } | Date | Error | Generator | Promise | RegExp; declare type MakeReadonly = T extends Map ? ReadonlyMap : T extends Set ? ReadonlySet : T extends [infer Head, ...infer Tail] ? readonly [Head, ...Tail] : T extends Array ? ReadonlyArray : T extends BuiltIn ? T : Readonly; export interface ZodReadonlyDef extends ZodTypeDef { innerType: T; typeName: ZodFirstPartyTypeKind.ZodReadonly; } export declare class ZodReadonly extends ZodType, ZodReadonlyDef, T["_input"]> { _parse(input: ParseInput): ParseReturnType; static create: (type: T_1, params?: RawCreateParams) => ZodReadonly; } declare type CustomParams = CustomErrorParams & { fatal?: boolean; }; export declare const custom: (check?: ((data: unknown) => any) | undefined, params?: string | CustomParams | ((input: any) => CustomParams), fatal?: boolean | undefined) => ZodType; export { ZodType as Schema, ZodType as ZodSchema }; export declare const late: { object: (shape: () => T, params?: RawCreateParams) => ZodObject, { [k in keyof baseObjectOutputType]: undefined extends baseObjectOutputType[k] ? never : k; }[keyof T]>]: objectUtil.addQuestionMarks, { [k in keyof baseObjectOutputType]: undefined extends baseObjectOutputType[k] ? never : k; }[keyof T]>[k_1]; }, { [k_2 in keyof baseObjectInputType]: baseObjectInputType[k_2]; }>; }; export declare enum ZodFirstPartyTypeKind { ZodString = "ZodString", ZodNumber = "ZodNumber", ZodNaN = "ZodNaN", ZodBigInt = "ZodBigInt", ZodBoolean = "ZodBoolean", ZodDate = "ZodDate", ZodSymbol = "ZodSymbol", ZodUndefined = "ZodUndefined", ZodNull = "ZodNull", ZodAny = "ZodAny", ZodUnknown = "ZodUnknown", ZodNever = "ZodNever", ZodVoid = "ZodVoid", ZodArray = "ZodArray", ZodObject = "ZodObject", ZodUnion = "ZodUnion", ZodDiscriminatedUnion = "ZodDiscriminatedUnion", ZodIntersection = "ZodIntersection", ZodTuple = "ZodTuple", ZodRecord = "ZodRecord", ZodMap = "ZodMap", ZodSet = "ZodSet", ZodFunction = "ZodFunction", ZodLazy = "ZodLazy", ZodLiteral = "ZodLiteral", ZodEnum = "ZodEnum", ZodEffects = "ZodEffects", ZodNativeEnum = "ZodNativeEnum", ZodOptional = "ZodOptional", ZodNullable = "ZodNullable", ZodDefault = "ZodDefault", ZodCatch = "ZodCatch", ZodPromise = "ZodPromise", ZodBranded = "ZodBranded", ZodPipeline = "ZodPipeline", ZodReadonly = "ZodReadonly" } export declare type ZodFirstPartySchemaTypes = ZodString | ZodNumber | ZodNaN | ZodBigInt | ZodBoolean | ZodDate | ZodUndefined | ZodNull | ZodAny | ZodUnknown | ZodNever | ZodVoid | ZodArray | ZodObject | ZodUnion | ZodDiscriminatedUnion | ZodIntersection | ZodTuple | ZodRecord | ZodMap | ZodSet | ZodFunction | ZodLazy | ZodLiteral | ZodEnum | ZodEffects | ZodNativeEnum | ZodOptional | ZodNullable | ZodDefault | ZodCatch | ZodPromise | ZodBranded | ZodPipeline; declare abstract class Class { constructor(..._: any[]); } declare const instanceOfType: (cls: T, params?: CustomParams) => ZodType, ZodTypeDef, InstanceType>; declare const stringType: (params?: ({ errorMap?: ZodErrorMap | undefined; invalid_type_error?: string | undefined; required_error?: string | undefined; description?: string | undefined; } & { coerce?: true | undefined; }) | undefined) => ZodString; declare const numberType: (params?: ({ errorMap?: ZodErrorMap | undefined; invalid_type_error?: string | undefined; required_error?: string | undefined; description?: string | undefined; } & { coerce?: boolean | undefined; }) | undefined) => ZodNumber; declare const nanType: (params?: RawCreateParams) => ZodNaN; declare const bigIntType: (params?: ({ errorMap?: ZodErrorMap | undefined; invalid_type_error?: string | undefined; required_error?: string | undefined; description?: string | undefined; } & { coerce?: boolean | undefined; }) | undefined) => ZodBigInt; declare const booleanType: (params?: ({ errorMap?: ZodErrorMap | undefined; invalid_type_error?: string | undefined; required_error?: string | undefined; description?: string | undefined; } & { coerce?: boolean | undefined; }) | undefined) => ZodBoolean; declare const dateType: (params?: ({ errorMap?: ZodErrorMap | undefined; invalid_type_error?: string | undefined; required_error?: string | undefined; description?: string | undefined; } & { coerce?: boolean | undefined; }) | undefined) => ZodDate; declare const symbolType: (params?: RawCreateParams) => ZodSymbol; declare const undefinedType: (params?: RawCreateParams) => ZodUndefined; declare const nullType: (params?: RawCreateParams) => ZodNull; declare const anyType: (params?: RawCreateParams) => ZodAny; declare const unknownType: (params?: RawCreateParams) => ZodUnknown; declare const neverType: (params?: RawCreateParams) => ZodNever; declare const voidType: (params?: RawCreateParams) => ZodVoid; declare const arrayType: (schema: T, params?: RawCreateParams) => ZodArray; declare const objectType: (shape: T, params?: RawCreateParams) => ZodObject, { [k in keyof baseObjectOutputType]: undefined extends baseObjectOutputType[k] ? never : k; }[keyof T]>]: objectUtil.addQuestionMarks, { [k in keyof baseObjectOutputType]: undefined extends baseObjectOutputType[k] ? never : k; }[keyof T]>[k_1]; }, { [k_2 in keyof baseObjectInputType]: baseObjectInputType[k_2]; }>; declare const strictObjectType: (shape: T, params?: RawCreateParams) => ZodObject, { [k in keyof baseObjectOutputType]: undefined extends baseObjectOutputType[k] ? never : k; }[keyof T]>]: objectUtil.addQuestionMarks, { [k in keyof baseObjectOutputType]: undefined extends baseObjectOutputType[k] ? never : k; }[keyof T]>[k_1]; }, { [k_2 in keyof baseObjectInputType]: baseObjectInputType[k_2]; }>; declare const unionType: (types: T, params?: RawCreateParams) => ZodUnion; declare const discriminatedUnionType: typeof ZodDiscriminatedUnion.create; declare const intersectionType: (left: T, right: U, params?: RawCreateParams) => ZodIntersection; declare const tupleType: (schemas: T, params?: RawCreateParams) => ZodTuple; declare const recordType: typeof ZodRecord.create; declare const mapType: (keyType: Key, valueType: Value, params?: RawCreateParams) => ZodMap; declare const setType: (valueType: Value, params?: RawCreateParams) => ZodSet; declare const functionType: typeof ZodFunction.create; declare const lazyType: (getter: () => T, params?: RawCreateParams) => ZodLazy; declare const literalType: (value: T, params?: RawCreateParams) => ZodLiteral; declare const enumType: typeof createZodEnum; declare const nativeEnumType: (values: T, params?: RawCreateParams) => ZodNativeEnum; declare const promiseType: (schema: T, params?: RawCreateParams) => ZodPromise; declare const effectsType: (schema: I, effect: Effect, params?: RawCreateParams) => ZodEffects>; declare const optionalType: (type: T, params?: RawCreateParams) => ZodOptional; declare const nullableType: (type: T, params?: RawCreateParams) => ZodNullable; declare const preprocessType: (preprocess: (arg: unknown, ctx: RefinementCtx) => unknown, schema: I, params?: RawCreateParams) => ZodEffects; declare const pipelineType: typeof ZodPipeline.create; declare const ostring: () => ZodOptional; declare const onumber: () => ZodOptional; declare const oboolean: () => ZodOptional; export declare const coerce: { string: (params?: ({ errorMap?: ZodErrorMap | undefined; invalid_type_error?: string | undefined; required_error?: string | undefined; description?: string | undefined; } & { coerce?: true | undefined; }) | undefined) => ZodString; number: (params?: ({ errorMap?: ZodErrorMap | undefined; invalid_type_error?: string | undefined; required_error?: string | undefined; description?: string | undefined; } & { coerce?: boolean | undefined; }) | undefined) => ZodNumber; boolean: (params?: ({ errorMap?: ZodErrorMap | undefined; invalid_type_error?: string | undefined; required_error?: string | undefined; description?: string | undefined; } & { coerce?: boolean | undefined; }) | undefined) => ZodBoolean; bigint: (params?: ({ errorMap?: ZodErrorMap | undefined; invalid_type_error?: string | undefined; required_error?: string | undefined; description?: string | undefined; } & { coerce?: boolean | undefined; }) | undefined) => ZodBigInt; date: (params?: ({ errorMap?: ZodErrorMap | undefined; invalid_type_error?: string | undefined; required_error?: string | undefined; description?: string | undefined; } & { coerce?: boolean | undefined; }) | undefined) => ZodDate; }; export { anyType as any, arrayType as array, bigIntType as bigint, booleanType as boolean, dateType as date, discriminatedUnionType as discriminatedUnion, effectsType as effect, enumType as enum, functionType as function, instanceOfType as instanceof, intersectionType as intersection, lazyType as lazy, literalType as literal, mapType as map, nanType as nan, nativeEnumType as nativeEnum, neverType as never, nullType as null, nullableType as nullable, numberType as number, objectType as object, oboolean, onumber, optionalType as optional, ostring, pipelineType as pipeline, preprocessType as preprocess, promiseType as promise, recordType as record, setType as set, strictObjectType as strictObject, stringType as string, symbolType as symbol, effectsType as transformer, tupleType as tuple, undefinedType as undefined, unionType as union, unknownType as unknown, voidType as void, }; export declare const NEVER: never;