Comparing version 3.23.0-canary.20240314T051637 to 3.23.0-canary.20240315T001949
"use strict"; | ||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { | ||
if (k2 === undefined) k2 = k; | ||
var desc = Object.getOwnPropertyDescriptor(m, k); | ||
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { | ||
desc = { enumerable: true, get: function() { return m[k]; } }; | ||
} | ||
Object.defineProperty(o, k2, desc); | ||
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); | ||
}) : (function(o, m, k, k2) { | ||
@@ -10,0 +6,0 @@ if (k2 === undefined) k2 = k; |
@@ -5,6 +5,6 @@ export declare namespace errorUtil { | ||
}; | ||
const errToObj: (message?: ErrMessage) => { | ||
const errToObj: (message?: ErrMessage | undefined) => { | ||
message?: string | undefined; | ||
}; | ||
const toString: (message?: ErrMessage) => string | undefined; | ||
const toString: (message?: ErrMessage | undefined) => string | undefined; | ||
} |
@@ -8,2 +8,2 @@ "use strict"; | ||
errorUtil.toString = (message) => typeof message === "string" ? message : message === null || message === void 0 ? void 0 : message.message; | ||
})(errorUtil || (exports.errorUtil = errorUtil = {})); | ||
})(errorUtil = exports.errorUtil || (exports.errorUtil = {})); |
@@ -9,3 +9,3 @@ import type { IssueData, ZodErrorMap, ZodIssue } from "../ZodError"; | ||
}) => ZodIssue; | ||
export type ParseParams = { | ||
export declare type ParseParams = { | ||
path: (string | number)[]; | ||
@@ -15,4 +15,4 @@ errorMap: ZodErrorMap; | ||
}; | ||
export type ParsePathComponent = string | number; | ||
export type ParsePath = ParsePathComponent[]; | ||
export declare type ParsePathComponent = string | number; | ||
export declare type ParsePath = ParsePathComponent[]; | ||
export declare const EMPTY_PATH: ParsePath; | ||
@@ -31,3 +31,3 @@ export interface ParseContext { | ||
} | ||
export type ParseInput = { | ||
export declare type ParseInput = { | ||
data: any; | ||
@@ -38,3 +38,3 @@ path: (string | number)[]; | ||
export declare function addIssueToContext(ctx: ParseContext, issueData: IssueData): void; | ||
export type ObjectPair = { | ||
export declare type ObjectPair = { | ||
key: SyncParseReturnType<any>; | ||
@@ -62,7 +62,7 @@ value: SyncParseReturnType<any>; | ||
} | ||
export type INVALID = { | ||
export declare type INVALID = { | ||
status: "aborted"; | ||
}; | ||
export declare const INVALID: INVALID; | ||
export type DIRTY<T> = { | ||
export declare type DIRTY<T> = { | ||
status: "dirty"; | ||
@@ -72,3 +72,3 @@ value: T; | ||
export declare const DIRTY: <T>(value: T) => DIRTY<T>; | ||
export type OK<T> = { | ||
export declare type OK<T> = { | ||
status: "valid"; | ||
@@ -78,5 +78,5 @@ value: T; | ||
export declare const OK: <T>(value: T) => OK<T>; | ||
export type SyncParseReturnType<T = any> = OK<T> | DIRTY<T> | INVALID; | ||
export type AsyncParseReturnType<T> = Promise<SyncParseReturnType<T>>; | ||
export type ParseReturnType<T> = SyncParseReturnType<T> | AsyncParseReturnType<T>; | ||
export declare type SyncParseReturnType<T = any> = OK<T> | DIRTY<T> | INVALID; | ||
export declare type AsyncParseReturnType<T> = Promise<SyncParseReturnType<T>>; | ||
export declare type ParseReturnType<T> = SyncParseReturnType<T> | AsyncParseReturnType<T>; | ||
export declare const isAborted: (x: ParseReturnType<any>) => x is INVALID; | ||
@@ -83,0 +83,0 @@ export declare const isDirty: <T>(x: ParseReturnType<T>) => x is OK<T> | DIRTY<T>; |
@@ -39,5 +39,5 @@ "use strict"; | ||
errorMaps: [ | ||
ctx.common.contextualErrorMap, // contextual error map is first priority | ||
ctx.schemaErrorMap, // then schema-bound map if available | ||
(0, errors_1.getErrorMap)(), // then global override map | ||
ctx.common.contextualErrorMap, | ||
ctx.schemaErrorMap, | ||
(0, errors_1.getErrorMap)(), | ||
en_1.default, // then global default map | ||
@@ -44,0 +44,0 @@ ].filter((x) => !!x), |
@@ -1,2 +0,2 @@ | ||
export type Primitive = string | number | symbol | bigint | boolean | null | undefined; | ||
export type Scalars = Primitive | Primitive[]; | ||
export declare type Primitive = string | number | symbol | bigint | boolean | null | undefined; | ||
export declare type Scalars = Primitive | Primitive[]; |
@@ -46,17 +46,16 @@ export declare namespace util { | ||
export declare const ZodParsedType: { | ||
function: "function"; | ||
number: "number"; | ||
string: "string"; | ||
number: "number"; | ||
bigint: "bigint"; | ||
boolean: "boolean"; | ||
symbol: "symbol"; | ||
undefined: "undefined"; | ||
object: "object"; | ||
function: "function"; | ||
map: "map"; | ||
nan: "nan"; | ||
integer: "integer"; | ||
float: "float"; | ||
boolean: "boolean"; | ||
date: "date"; | ||
bigint: "bigint"; | ||
symbol: "symbol"; | ||
undefined: "undefined"; | ||
null: "null"; | ||
array: "array"; | ||
object: "object"; | ||
unknown: "unknown"; | ||
@@ -66,5 +65,6 @@ promise: "promise"; | ||
never: "never"; | ||
map: "map"; | ||
set: "set"; | ||
}; | ||
export type ZodParsedType = keyof typeof ZodParsedType; | ||
export declare type ZodParsedType = keyof typeof ZodParsedType; | ||
export declare const getParsedType: (data: any) => ZodParsedType; |
@@ -66,3 +66,3 @@ "use strict"; | ||
}; | ||
})(util || (exports.util = util = {})); | ||
})(util = exports.util || (exports.util = {})); | ||
var objectUtil; | ||
@@ -76,3 +76,3 @@ (function (objectUtil) { | ||
}; | ||
})(objectUtil || (exports.objectUtil = objectUtil = {})); | ||
})(objectUtil = exports.objectUtil || (exports.objectUtil = {})); | ||
exports.ZodParsedType = util.arrayToEnum([ | ||
@@ -79,0 +79,0 @@ "string", |
"use strict"; | ||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { | ||
if (k2 === undefined) k2 = k; | ||
var desc = Object.getOwnPropertyDescriptor(m, k); | ||
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { | ||
desc = { enumerable: true, get: function() { return m[k]; } }; | ||
} | ||
Object.defineProperty(o, k2, desc); | ||
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); | ||
}) : (function(o, m, k, k2) { | ||
@@ -10,0 +6,0 @@ if (k2 === undefined) k2 = k; |
@@ -8,15 +8,15 @@ import { enumUtil } from "./helpers/enumUtil"; | ||
import { IssueData, StringValidation, ZodCustomIssue, ZodError, ZodErrorMap } from "./ZodError"; | ||
export type RefinementCtx = { | ||
export declare type RefinementCtx = { | ||
addIssue: (arg: IssueData) => void; | ||
path: (string | number)[]; | ||
}; | ||
export type ZodRawShape = { | ||
export declare type ZodRawShape = { | ||
[k: string]: ZodTypeAny; | ||
}; | ||
export type ZodTypeAny = ZodType<any, any, any>; | ||
export type TypeOf<T extends ZodType<any, any, any>> = T["_output"]; | ||
export type input<T extends ZodType<any, any, any>> = T["_input"]; | ||
export type output<T extends ZodType<any, any, any>> = T["_output"]; | ||
export declare type ZodTypeAny = ZodType<any, any, any>; | ||
export declare type TypeOf<T extends ZodType<any, any, any>> = T["_output"]; | ||
export declare type input<T extends ZodType<any, any, any>> = T["_input"]; | ||
export declare type output<T extends ZodType<any, any, any>> = T["_output"]; | ||
export type { TypeOf as infer }; | ||
export type CustomErrorParams = Partial<util.Omit<ZodCustomIssue, "code">>; | ||
export declare type CustomErrorParams = Partial<util.Omit<ZodCustomIssue, "code">>; | ||
export interface ZodTypeDef { | ||
@@ -26,3 +26,3 @@ errorMap?: ZodErrorMap; | ||
} | ||
export type RawCreateParams = { | ||
export declare type RawCreateParams = { | ||
errorMap?: ZodErrorMap; | ||
@@ -33,15 +33,15 @@ invalid_type_error?: string; | ||
} | undefined; | ||
export type ProcessedCreateParams = { | ||
export declare type ProcessedCreateParams = { | ||
errorMap?: ZodErrorMap; | ||
description?: string; | ||
}; | ||
export type SafeParseSuccess<Output> = { | ||
export declare type SafeParseSuccess<Output> = { | ||
success: true; | ||
data: Output; | ||
}; | ||
export type SafeParseError<Input> = { | ||
export declare type SafeParseError<Input> = { | ||
success: false; | ||
error: ZodError<Input>; | ||
}; | ||
export type SafeParseReturnType<Input, Output> = SafeParseSuccess<Output> | SafeParseError<Input>; | ||
export declare type SafeParseReturnType<Input, Output> = SafeParseSuccess<Output> | SafeParseError<Input>; | ||
export declare abstract class ZodType<Output = any, Def extends ZodTypeDef = ZodTypeDef, Input = Output> { | ||
@@ -67,3 +67,3 @@ readonly _type: Output; | ||
/** Alias of safeParseAsync */ | ||
spa: (data: unknown, params?: Partial<ParseParams>) => Promise<SafeParseReturnType<Input, Output>>; | ||
spa: (data: unknown, params?: Partial<ParseParams> | undefined) => Promise<SafeParseReturnType<Input, Output>>; | ||
refine<RefinedOutput extends Output>(check: (arg: Output) => arg is RefinedOutput, message?: string | CustomErrorParams | ((arg: Output) => CustomErrorParams)): ZodEffects<this, RefinedOutput, Input>; | ||
@@ -100,4 +100,4 @@ refine(check: (arg: Output) => unknown | Promise<unknown>, message?: string | CustomErrorParams | ((arg: Output) => CustomErrorParams)): ZodEffects<this, Output, Input>; | ||
} | ||
export type IpVersion = "v4" | "v6"; | ||
export type ZodStringCheck = { | ||
export declare type IpVersion = "v4" | "v6"; | ||
export declare type ZodStringCheck = { | ||
kind: "min"; | ||
@@ -225,7 +225,12 @@ value: number; | ||
get maxLength(): number | null; | ||
static create: (params?: RawCreateParams & { | ||
coerce?: true; | ||
}) => ZodString; | ||
static create: (params?: ({ | ||
errorMap?: ZodErrorMap | undefined; | ||
invalid_type_error?: string | undefined; | ||
required_error?: string | undefined; | ||
description?: string | undefined; | ||
} & { | ||
coerce?: true | undefined; | ||
}) | undefined) => ZodString; | ||
} | ||
export type ZodNumberCheck = { | ||
export declare type ZodNumberCheck = { | ||
kind: "min"; | ||
@@ -258,10 +263,15 @@ value: number; | ||
_parse(input: ParseInput): ParseReturnType<number>; | ||
static create: (params?: RawCreateParams & { | ||
coerce?: boolean; | ||
}) => ZodNumber; | ||
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) => 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) => ZodNumber; | ||
max: (value: number, message?: errorUtil.ErrMessage | undefined) => ZodNumber; | ||
lt(value: number, message?: errorUtil.ErrMessage): ZodNumber; | ||
@@ -276,3 +286,3 @@ protected setLimit(kind: "min" | "max", value: number, inclusive: boolean, message?: string): ZodNumber; | ||
multipleOf(value: number, message?: errorUtil.ErrMessage): ZodNumber; | ||
step: (value: number, message?: errorUtil.ErrMessage) => ZodNumber; | ||
step: (value: number, message?: errorUtil.ErrMessage | undefined) => ZodNumber; | ||
finite(message?: errorUtil.ErrMessage): ZodNumber; | ||
@@ -285,3 +295,3 @@ safe(message?: errorUtil.ErrMessage): ZodNumber; | ||
} | ||
export type ZodBigIntCheck = { | ||
export declare type ZodBigIntCheck = { | ||
kind: "min"; | ||
@@ -308,10 +318,15 @@ value: bigint; | ||
_parse(input: ParseInput): ParseReturnType<bigint>; | ||
static create: (params?: RawCreateParams & { | ||
coerce?: boolean; | ||
}) => ZodBigInt; | ||
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) => 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) => ZodBigInt; | ||
max: (value: bigint, message?: errorUtil.ErrMessage | undefined) => ZodBigInt; | ||
lt(value: bigint, message?: errorUtil.ErrMessage): ZodBigInt; | ||
@@ -334,7 +349,12 @@ protected setLimit(kind: "min" | "max", value: bigint, inclusive: boolean, message?: string): ZodBigInt; | ||
_parse(input: ParseInput): ParseReturnType<boolean>; | ||
static create: (params?: RawCreateParams & { | ||
coerce?: boolean; | ||
}) => ZodBoolean; | ||
static create: (params?: ({ | ||
errorMap?: ZodErrorMap | undefined; | ||
invalid_type_error?: string | undefined; | ||
required_error?: string | undefined; | ||
description?: string | undefined; | ||
} & { | ||
coerce?: boolean | undefined; | ||
}) | undefined) => ZodBoolean; | ||
} | ||
export type ZodDateCheck = { | ||
export declare type ZodDateCheck = { | ||
kind: "min"; | ||
@@ -360,5 +380,10 @@ value: number; | ||
get maxDate(): Date | null; | ||
static create: (params?: RawCreateParams & { | ||
coerce?: boolean; | ||
}) => ZodDate; | ||
static create: (params?: ({ | ||
errorMap?: ZodErrorMap | undefined; | ||
invalid_type_error?: string | undefined; | ||
required_error?: string | undefined; | ||
description?: string | undefined; | ||
} & { | ||
coerce?: boolean | undefined; | ||
}) | undefined) => ZodDate; | ||
} | ||
@@ -433,4 +458,4 @@ export interface ZodSymbolDef extends ZodTypeDef { | ||
} | ||
export type ArrayCardinality = "many" | "atleastone"; | ||
export type arrayOutputType<T extends ZodTypeAny, Cardinality extends ArrayCardinality = "many"> = Cardinality extends "atleastone" ? [T["_output"], ...T["_output"][]] : T["_output"][]; | ||
export declare type ArrayCardinality = "many" | "atleastone"; | ||
export declare type arrayOutputType<T extends ZodTypeAny, Cardinality extends ArrayCardinality = "many"> = Cardinality extends "atleastone" ? [T["_output"], ...T["_output"][]] : T["_output"][]; | ||
export declare class ZodArray<T extends ZodTypeAny, Cardinality extends ArrayCardinality = "many"> extends ZodType<arrayOutputType<T, Cardinality>, ZodArrayDef<T>, Cardinality extends "atleastone" ? [T["_input"], ...T["_input"][]] : T["_input"][]> { | ||
@@ -445,4 +470,4 @@ _parse(input: ParseInput): ParseReturnType<this["_output"]>; | ||
} | ||
export type ZodNonEmptyArray<T extends ZodTypeAny> = ZodArray<T, "atleastone">; | ||
export type UnknownKeysParam = "passthrough" | "strict" | "strip"; | ||
export declare type ZodNonEmptyArray<T extends ZodTypeAny> = ZodArray<T, "atleastone">; | ||
export declare type UnknownKeysParam = "passthrough" | "strict" | "strip"; | ||
export interface ZodObjectDef<T extends ZodRawShape = ZodRawShape, UnknownKeys extends UnknownKeysParam = UnknownKeysParam, Catchall extends ZodTypeAny = ZodTypeAny> extends ZodTypeDef { | ||
@@ -454,25 +479,25 @@ typeName: ZodFirstPartyTypeKind.ZodObject; | ||
} | ||
export type mergeTypes<A, B> = { | ||
export declare type mergeTypes<A, B> = { | ||
[k in keyof A | keyof B]: k extends keyof B ? B[k] : k extends keyof A ? A[k] : never; | ||
}; | ||
export type objectOutputType<Shape extends ZodRawShape, Catchall extends ZodTypeAny, UnknownKeys extends UnknownKeysParam = UnknownKeysParam> = objectUtil.flatten<objectUtil.addQuestionMarks<baseObjectOutputType<Shape>>> & CatchallOutput<Catchall> & PassthroughType<UnknownKeys>; | ||
export type baseObjectOutputType<Shape extends ZodRawShape> = { | ||
export declare type objectOutputType<Shape extends ZodRawShape, Catchall extends ZodTypeAny, UnknownKeys extends UnknownKeysParam = UnknownKeysParam> = objectUtil.flatten<objectUtil.addQuestionMarks<baseObjectOutputType<Shape>>> & CatchallOutput<Catchall> & PassthroughType<UnknownKeys>; | ||
export declare type baseObjectOutputType<Shape extends ZodRawShape> = { | ||
[k in keyof Shape]: Shape[k]["_output"]; | ||
}; | ||
export type objectInputType<Shape extends ZodRawShape, Catchall extends ZodTypeAny, UnknownKeys extends UnknownKeysParam = UnknownKeysParam> = objectUtil.flatten<baseObjectInputType<Shape>> & CatchallInput<Catchall> & PassthroughType<UnknownKeys>; | ||
export type baseObjectInputType<Shape extends ZodRawShape> = objectUtil.addQuestionMarks<{ | ||
export declare type objectInputType<Shape extends ZodRawShape, Catchall extends ZodTypeAny, UnknownKeys extends UnknownKeysParam = UnknownKeysParam> = objectUtil.flatten<baseObjectInputType<Shape>> & CatchallInput<Catchall> & PassthroughType<UnknownKeys>; | ||
export declare type baseObjectInputType<Shape extends ZodRawShape> = objectUtil.addQuestionMarks<{ | ||
[k in keyof Shape]: Shape[k]["_input"]; | ||
}>; | ||
export type CatchallOutput<T extends ZodTypeAny> = ZodTypeAny extends T ? unknown : { | ||
export declare type CatchallOutput<T extends ZodTypeAny> = ZodTypeAny extends T ? unknown : { | ||
[k: string]: T["_output"]; | ||
}; | ||
export type CatchallInput<T extends ZodTypeAny> = ZodTypeAny extends T ? unknown : { | ||
export declare type CatchallInput<T extends ZodTypeAny> = ZodTypeAny extends T ? unknown : { | ||
[k: string]: T["_input"]; | ||
}; | ||
export type PassthroughType<T extends UnknownKeysParam> = T extends "passthrough" ? { | ||
export declare type PassthroughType<T extends UnknownKeysParam> = T extends "passthrough" ? { | ||
[k: string]: unknown; | ||
} : unknown; | ||
export type deoptional<T extends ZodTypeAny> = T extends ZodOptional<infer U> ? deoptional<U> : T extends ZodNullable<infer U> ? ZodNullable<deoptional<U>> : T; | ||
export type SomeZodObject = ZodObject<ZodRawShape, UnknownKeysParam, ZodTypeAny>; | ||
export type noUnrecognized<Obj extends object, Shape extends object> = { | ||
export declare type deoptional<T extends ZodTypeAny> = T extends ZodOptional<infer U> ? deoptional<U> : T extends ZodNullable<infer U> ? ZodNullable<deoptional<U>> : T; | ||
export declare type SomeZodObject = ZodObject<ZodRawShape, UnknownKeysParam, ZodTypeAny>; | ||
export declare type noUnrecognized<Obj extends object, Shape extends object> = { | ||
[k in keyof Obj]: k extends keyof Shape ? Obj[k] : never; | ||
@@ -500,3 +525,3 @@ }; | ||
* */ | ||
augment: <Augmentation extends ZodRawShape>(augmentation: Augmentation) => ZodObject<objectUtil.extendShape<T, Augmentation>, UnknownKeys, Catchall>; | ||
augment: <Augmentation extends ZodRawShape>(augmentation: Augmentation) => ZodObject<{ [k in keyof (Omit<T, keyof Augmentation> & Augmentation)]: (Omit<T, keyof Augmentation> & Augmentation)[k]; }, UnknownKeys, Catchall, objectOutputType<{ [k in keyof (Omit<T, keyof Augmentation> & Augmentation)]: (Omit<T, keyof Augmentation> & Augmentation)[k]; }, Catchall, UnknownKeys>, objectInputType<{ [k in keyof (Omit<T, keyof Augmentation> & Augmentation)]: (Omit<T, keyof Augmentation> & Augmentation)[k]; }, Catchall, UnknownKeys>>; | ||
/** | ||
@@ -539,8 +564,8 @@ * Prior to zod@1.0.12 there was a bug in the | ||
keyof(): ZodEnum<enumUtil.UnionToTupleString<keyof T>>; | ||
static create: <T_1 extends ZodRawShape>(shape: T_1, params?: RawCreateParams) => ZodObject<T_1, "strip", ZodTypeAny, objectUtil.addQuestionMarks<baseObjectOutputType<T_1>, { [k_1 in keyof baseObjectOutputType<T_1>]: undefined extends baseObjectOutputType<T_1>[k_1] ? never : k_1; }[keyof T_1]> extends infer T_2 ? { [k in keyof T_2]: objectUtil.addQuestionMarks<baseObjectOutputType<T_1>, { [k_1 in keyof baseObjectOutputType<T_1>]: undefined extends baseObjectOutputType<T_1>[k_1] ? never : k_1; }[keyof T_1]>[k]; } : never, baseObjectInputType<T_1> extends infer T_3 ? { [k_2 in keyof T_3]: baseObjectInputType<T_1>[k_2]; } : never>; | ||
static strictCreate: <T_1 extends ZodRawShape>(shape: T_1, params?: RawCreateParams) => ZodObject<T_1, "strict", ZodTypeAny, objectUtil.addQuestionMarks<baseObjectOutputType<T_1>, { [k_1 in keyof baseObjectOutputType<T_1>]: undefined extends baseObjectOutputType<T_1>[k_1] ? never : k_1; }[keyof T_1]> extends infer T_2 ? { [k in keyof T_2]: objectUtil.addQuestionMarks<baseObjectOutputType<T_1>, { [k_1 in keyof baseObjectOutputType<T_1>]: undefined extends baseObjectOutputType<T_1>[k_1] ? never : k_1; }[keyof T_1]>[k]; } : never, baseObjectInputType<T_1> extends infer T_3 ? { [k_2 in keyof T_3]: baseObjectInputType<T_1>[k_2]; } : never>; | ||
static lazycreate: <T_1 extends ZodRawShape>(shape: () => T_1, params?: RawCreateParams) => ZodObject<T_1, "strip", ZodTypeAny, objectUtil.addQuestionMarks<baseObjectOutputType<T_1>, { [k_1 in keyof baseObjectOutputType<T_1>]: undefined extends baseObjectOutputType<T_1>[k_1] ? never : k_1; }[keyof T_1]> extends infer T_2 ? { [k in keyof T_2]: objectUtil.addQuestionMarks<baseObjectOutputType<T_1>, { [k_1 in keyof baseObjectOutputType<T_1>]: undefined extends baseObjectOutputType<T_1>[k_1] ? never : k_1; }[keyof T_1]>[k]; } : never, baseObjectInputType<T_1> extends infer T_3 ? { [k_2 in keyof T_3]: baseObjectInputType<T_1>[k_2]; } : never>; | ||
static create: <T_1 extends ZodRawShape>(shape: T_1, params?: RawCreateParams) => ZodObject<T_1, "strip", ZodTypeAny, { [k_1 in keyof objectUtil.addQuestionMarks<baseObjectOutputType<T_1>, { [k in keyof baseObjectOutputType<T_1>]: undefined extends baseObjectOutputType<T_1>[k] ? never : k; }[keyof T_1]>]: objectUtil.addQuestionMarks<baseObjectOutputType<T_1>, { [k in keyof baseObjectOutputType<T_1>]: undefined extends baseObjectOutputType<T_1>[k] ? never : k; }[keyof T_1]>[k_1]; }, { [k_2 in keyof baseObjectInputType<T_1>]: baseObjectInputType<T_1>[k_2]; }>; | ||
static strictCreate: <T_1 extends ZodRawShape>(shape: T_1, params?: RawCreateParams) => ZodObject<T_1, "strict", ZodTypeAny, { [k_1 in keyof objectUtil.addQuestionMarks<baseObjectOutputType<T_1>, { [k in keyof baseObjectOutputType<T_1>]: undefined extends baseObjectOutputType<T_1>[k] ? never : k; }[keyof T_1]>]: objectUtil.addQuestionMarks<baseObjectOutputType<T_1>, { [k in keyof baseObjectOutputType<T_1>]: undefined extends baseObjectOutputType<T_1>[k] ? never : k; }[keyof T_1]>[k_1]; }, { [k_2 in keyof baseObjectInputType<T_1>]: baseObjectInputType<T_1>[k_2]; }>; | ||
static lazycreate: <T_1 extends ZodRawShape>(shape: () => T_1, params?: RawCreateParams) => ZodObject<T_1, "strip", ZodTypeAny, { [k_1 in keyof objectUtil.addQuestionMarks<baseObjectOutputType<T_1>, { [k in keyof baseObjectOutputType<T_1>]: undefined extends baseObjectOutputType<T_1>[k] ? never : k; }[keyof T_1]>]: objectUtil.addQuestionMarks<baseObjectOutputType<T_1>, { [k in keyof baseObjectOutputType<T_1>]: undefined extends baseObjectOutputType<T_1>[k] ? never : k; }[keyof T_1]>[k_1]; }, { [k_2 in keyof baseObjectInputType<T_1>]: baseObjectInputType<T_1>[k_2]; }>; | ||
} | ||
export type AnyZodObject = ZodObject<any, any, any>; | ||
export type ZodUnionOptions = Readonly<[ZodTypeAny, ...ZodTypeAny[]]>; | ||
export declare type AnyZodObject = ZodObject<any, any, any>; | ||
export declare type ZodUnionOptions = Readonly<[ZodTypeAny, ...ZodTypeAny[]]>; | ||
export interface ZodUnionDef<T extends ZodUnionOptions = Readonly<[ | ||
@@ -559,3 +584,3 @@ ZodTypeAny, | ||
} | ||
export type ZodDiscriminatedUnionOption<Discriminator extends string> = ZodObject<{ | ||
export declare type ZodDiscriminatedUnionOption<Discriminator extends string> = ZodObject<{ | ||
[key in Discriminator]: ZodTypeAny; | ||
@@ -596,12 +621,12 @@ } & ZodRawShape, UnknownKeysParam, ZodTypeAny>; | ||
} | ||
export type ZodTupleItems = [ZodTypeAny, ...ZodTypeAny[]]; | ||
export type AssertArray<T> = T extends any[] ? T : never; | ||
export type OutputTypeOfTuple<T extends ZodTupleItems | []> = AssertArray<{ | ||
export declare type ZodTupleItems = [ZodTypeAny, ...ZodTypeAny[]]; | ||
export declare type AssertArray<T> = T extends any[] ? T : never; | ||
export declare type OutputTypeOfTuple<T extends ZodTupleItems | []> = AssertArray<{ | ||
[k in keyof T]: T[k] extends ZodType<any, any> ? T[k]["_output"] : never; | ||
}>; | ||
export type OutputTypeOfTupleWithRest<T extends ZodTupleItems | [], Rest extends ZodTypeAny | null = null> = Rest extends ZodTypeAny ? [...OutputTypeOfTuple<T>, ...Rest["_output"][]] : OutputTypeOfTuple<T>; | ||
export type InputTypeOfTuple<T extends ZodTupleItems | []> = AssertArray<{ | ||
export declare type OutputTypeOfTupleWithRest<T extends ZodTupleItems | [], Rest extends ZodTypeAny | null = null> = Rest extends ZodTypeAny ? [...OutputTypeOfTuple<T>, ...Rest["_output"][]] : OutputTypeOfTuple<T>; | ||
export declare type InputTypeOfTuple<T extends ZodTupleItems | []> = AssertArray<{ | ||
[k in keyof T]: T[k] extends ZodType<any, any> ? T[k]["_input"] : never; | ||
}>; | ||
export type InputTypeOfTupleWithRest<T extends ZodTupleItems | [], Rest extends ZodTypeAny | null = null> = Rest extends ZodTypeAny ? [...InputTypeOfTuple<T>, ...Rest["_input"][]] : InputTypeOfTuple<T>; | ||
export declare type InputTypeOfTupleWithRest<T extends ZodTupleItems | [], Rest extends ZodTypeAny | null = null> = Rest extends ZodTypeAny ? [...InputTypeOfTuple<T>, ...Rest["_input"][]] : InputTypeOfTuple<T>; | ||
export interface ZodTupleDef<T extends ZodTupleItems | [] = ZodTupleItems, Rest extends ZodTypeAny | null = null> extends ZodTypeDef { | ||
@@ -612,3 +637,3 @@ items: T; | ||
} | ||
export type AnyZodTuple = ZodTuple<[ | ||
export declare type AnyZodTuple = ZodTuple<[ | ||
ZodTypeAny, | ||
@@ -628,4 +653,4 @@ ...ZodTypeAny[] | ||
} | ||
export type KeySchema = ZodType<string | number | symbol, any, any>; | ||
export type RecordType<K extends string | number | symbol, V> = [ | ||
export declare type KeySchema = ZodType<string | number | symbol, any, any>; | ||
export declare type RecordType<K extends string | number | symbol, V> = [ | ||
string | ||
@@ -677,4 +702,4 @@ ] extends [K] ? Record<K, V> : [number] extends [K] ? Record<K, V> : [symbol] extends [K] ? Record<K, V> : [BRAND<string | number | symbol>] extends [K] ? Record<K, V> : Partial<Record<K, V>>; | ||
} | ||
export type OuterTypeOfFunction<Args extends ZodTuple<any, any>, Returns extends ZodTypeAny> = Args["_input"] extends Array<any> ? (...args: Args["_input"]) => Returns["_output"] : never; | ||
export type InnerTypeOfFunction<Args extends ZodTuple<any, any>, Returns extends ZodTypeAny> = Args["_output"] extends Array<any> ? (...args: Args["_output"]) => Returns["_input"] : never; | ||
export declare type OuterTypeOfFunction<Args extends ZodTuple<any, any>, Returns extends ZodTypeAny> = Args["_input"] extends Array<any> ? (...args: Args["_input"]) => Returns["_output"] : never; | ||
export declare type InnerTypeOfFunction<Args extends ZodTuple<any, any>, Returns extends ZodTypeAny> = Args["_output"] extends Array<any> ? (...args: Args["_output"]) => Returns["_input"] : never; | ||
export declare class ZodFunction<Args extends ZodTuple<any, any>, Returns extends ZodTypeAny> extends ZodType<OuterTypeOfFunction<Args, Returns>, ZodFunctionDef<Args, Returns>, InnerTypeOfFunction<Args, Returns>> { | ||
@@ -712,6 +737,6 @@ _parse(input: ParseInput): ParseReturnType<any>; | ||
} | ||
export type ArrayKeys = keyof any[]; | ||
export type Indices<T> = Exclude<keyof T, ArrayKeys>; | ||
export type EnumValues = [string, ...string[]]; | ||
export type Values<T extends EnumValues> = { | ||
export declare type ArrayKeys = keyof any[]; | ||
export declare type Indices<T> = Exclude<keyof T, ArrayKeys>; | ||
export declare type EnumValues = [string, ...string[]]; | ||
export declare type Values<T extends EnumValues> = { | ||
[k in T[number]]: k; | ||
@@ -723,7 +748,7 @@ }; | ||
} | ||
export type Writeable<T> = { | ||
export declare type Writeable<T> = { | ||
-readonly [P in keyof T]: T[P]; | ||
}; | ||
export type FilterEnum<Values, ToExclude> = Values extends [] ? [] : Values extends [infer Head, ...infer Rest] ? Head extends ToExclude ? FilterEnum<Rest, ToExclude> : [Head, ...FilterEnum<Rest, ToExclude>] : never; | ||
export type typecast<A, T> = A extends T ? A : never; | ||
export declare type FilterEnum<Values, ToExclude> = Values extends [] ? [] : Values extends [infer Head, ...infer Rest] ? Head extends ToExclude ? FilterEnum<Rest, ToExclude> : [Head, ...FilterEnum<Rest, ToExclude>] : never; | ||
export declare type typecast<A, T> = A extends T ? A : never; | ||
declare function createZodEnum<U extends string, T extends Readonly<[U, ...U[]]>>(values: T, params?: RawCreateParams): ZodEnum<Writeable<T>>; | ||
@@ -745,3 +770,3 @@ declare function createZodEnum<U extends string, T extends [U, ...U[]]>(values: T, params?: RawCreateParams): ZodEnum<T>; | ||
} | ||
export type EnumLike = { | ||
export declare type EnumLike = { | ||
[k: string]: string | number; | ||
@@ -764,17 +789,17 @@ [nu: number]: string; | ||
} | ||
export type Refinement<T> = (arg: T, ctx: RefinementCtx) => any; | ||
export type SuperRefinement<T> = (arg: T, ctx: RefinementCtx) => void | Promise<void>; | ||
export type RefinementEffect<T> = { | ||
export declare type Refinement<T> = (arg: T, ctx: RefinementCtx) => any; | ||
export declare type SuperRefinement<T> = (arg: T, ctx: RefinementCtx) => void | Promise<void>; | ||
export declare type RefinementEffect<T> = { | ||
type: "refinement"; | ||
refinement: (arg: T, ctx: RefinementCtx) => any; | ||
}; | ||
export type TransformEffect<T> = { | ||
export declare type TransformEffect<T> = { | ||
type: "transform"; | ||
transform: (arg: T, ctx: RefinementCtx) => any; | ||
}; | ||
export type PreprocessEffect<T> = { | ||
export declare type PreprocessEffect<T> = { | ||
type: "preprocess"; | ||
transform: (arg: T, ctx: RefinementCtx) => any; | ||
}; | ||
export type Effect<T> = RefinementEffect<T> | TransformEffect<T> | PreprocessEffect<T>; | ||
export declare type Effect<T> = RefinementEffect<T> | TransformEffect<T> | PreprocessEffect<T>; | ||
export interface ZodEffectsDef<T extends ZodTypeAny = ZodTypeAny> extends ZodTypeDef { | ||
@@ -789,3 +814,3 @@ schema: T; | ||
_parse(input: ParseInput): ParseReturnType<this["_output"]>; | ||
static create: <I extends ZodTypeAny>(schema: I, effect: Effect<I["_output"]>, params?: RawCreateParams) => ZodEffects<I, I["_output"]>; | ||
static create: <I extends ZodTypeAny>(schema: I, effect: Effect<I["_output"]>, params?: RawCreateParams) => ZodEffects<I, I["_output"], input<I>>; | ||
static createWithPreprocess: <I extends ZodTypeAny>(preprocess: (arg: unknown, ctx: RefinementCtx) => unknown, schema: I, params?: RawCreateParams) => ZodEffects<I, I["_output"], unknown>; | ||
@@ -798,3 +823,3 @@ } | ||
} | ||
export type ZodOptionalType<T extends ZodTypeAny> = ZodOptional<T>; | ||
export declare type ZodOptionalType<T extends ZodTypeAny> = ZodOptional<T>; | ||
export declare class ZodOptional<T extends ZodTypeAny> extends ZodType<T["_output"] | undefined, ZodOptionalDef<T>, T["_input"] | undefined> { | ||
@@ -809,3 +834,3 @@ _parse(input: ParseInput): ParseReturnType<this["_output"]>; | ||
} | ||
export type ZodNullableType<T extends ZodTypeAny> = ZodNullable<T>; | ||
export declare type ZodNullableType<T extends ZodTypeAny> = ZodNullable<T>; | ||
export declare class ZodNullable<T extends ZodTypeAny> extends ZodType<T["_output"] | null, ZodNullableDef<T>, T["_input"] | null> { | ||
@@ -865,3 +890,3 @@ _parse(input: ParseInput): ParseReturnType<this["_output"]>; | ||
export declare const BRAND: unique symbol; | ||
export type BRAND<T extends string | number | symbol> = { | ||
export declare type BRAND<T extends string | number | symbol> = { | ||
[BRAND]: { | ||
@@ -884,6 +909,6 @@ [k in T]: true; | ||
} | ||
type BuiltIn = (((...args: any[]) => any) | (new (...args: any[]) => any)) | { | ||
declare type BuiltIn = (((...args: any[]) => any) | (new (...args: any[]) => any)) | { | ||
readonly [Symbol.toStringTag]: string; | ||
} | Date | Error | Generator | Promise<unknown> | RegExp; | ||
type MakeReadonly<T> = T extends Map<infer K, infer V> ? ReadonlyMap<K, V> : T extends Set<infer V> ? ReadonlySet<V> : T extends [infer Head, ...infer Tail] ? readonly [Head, ...Tail] : T extends Array<infer V> ? ReadonlyArray<V> : T extends BuiltIn ? T : Readonly<T>; | ||
declare type MakeReadonly<T> = T extends Map<infer K, infer V> ? ReadonlyMap<K, V> : T extends Set<infer V> ? ReadonlySet<V> : T extends [infer Head, ...infer Tail] ? readonly [Head, ...Tail] : T extends Array<infer V> ? ReadonlyArray<V> : T extends BuiltIn ? T : Readonly<T>; | ||
export interface ZodReadonlyDef<T extends ZodTypeAny = ZodTypeAny> extends ZodTypeDef { | ||
@@ -897,9 +922,9 @@ innerType: T; | ||
} | ||
type CustomParams = CustomErrorParams & { | ||
declare type CustomParams = CustomErrorParams & { | ||
fatal?: boolean; | ||
}; | ||
export declare const custom: <T>(check?: ((data: unknown) => any) | undefined, params?: string | CustomParams | ((input: any) => CustomParams), fatal?: boolean) => ZodType<T>; | ||
export declare const custom: <T>(check?: ((data: unknown) => any) | undefined, params?: string | CustomParams | ((input: any) => CustomParams), fatal?: boolean | undefined) => ZodType<T, ZodTypeDef, T>; | ||
export { ZodType as Schema, ZodType as ZodSchema }; | ||
export declare const late: { | ||
object: <T extends ZodRawShape>(shape: () => T, params?: RawCreateParams) => ZodObject<T, "strip">; | ||
object: <T extends ZodRawShape>(shape: () => T, params?: RawCreateParams) => ZodObject<T, "strip", ZodTypeAny, { [k_1 in keyof objectUtil.addQuestionMarks<baseObjectOutputType<T>, { [k in keyof baseObjectOutputType<T>]: undefined extends baseObjectOutputType<T>[k] ? never : k; }[keyof T]>]: objectUtil.addQuestionMarks<baseObjectOutputType<T>, { [k in keyof baseObjectOutputType<T>]: undefined extends baseObjectOutputType<T>[k] ? never : k; }[keyof T]>[k_1]; }, { [k_2 in keyof baseObjectInputType<T>]: baseObjectInputType<T>[k_2]; }>; | ||
}; | ||
@@ -944,3 +969,3 @@ export declare enum ZodFirstPartyTypeKind { | ||
} | ||
export type ZodFirstPartySchemaTypes = ZodString | ZodNumber | ZodNaN | ZodBigInt | ZodBoolean | ZodDate | ZodUndefined | ZodNull | ZodAny | ZodUnknown | ZodNever | ZodVoid | ZodArray<any, any> | ZodObject<any, any, any> | ZodUnion<any> | ZodDiscriminatedUnion<any, any> | ZodIntersection<any, any> | ZodTuple<any, any> | ZodRecord<any, any> | ZodMap<any> | ZodSet<any> | ZodFunction<any, any> | ZodLazy<any> | ZodLiteral<any> | ZodEnum<any> | ZodEffects<any, any, any> | ZodNativeEnum<any> | ZodOptional<any> | ZodNullable<any> | ZodDefault<any> | ZodCatch<any> | ZodPromise<any> | ZodBranded<any, any> | ZodPipeline<any, any> | ZodReadonly<any> | ZodSymbol; | ||
export declare type ZodFirstPartySchemaTypes = ZodString | ZodNumber | ZodNaN | ZodBigInt | ZodBoolean | ZodDate | ZodUndefined | ZodNull | ZodAny | ZodUnknown | ZodNever | ZodVoid | ZodArray<any, any> | ZodObject<any, any, any> | ZodUnion<any> | ZodDiscriminatedUnion<any, any> | ZodIntersection<any, any> | ZodTuple<any, any> | ZodRecord<any, any> | ZodMap<any> | ZodSet<any> | ZodFunction<any, any> | ZodLazy<any> | ZodLiteral<any> | ZodEnum<any> | ZodEffects<any, any, any> | ZodNativeEnum<any> | ZodOptional<any> | ZodNullable<any> | ZodDefault<any> | ZodCatch<any> | ZodPromise<any> | ZodBranded<any, any> | ZodPipeline<any, any> | ZodReadonly<any> | ZodSymbol; | ||
declare abstract class Class { | ||
@@ -950,18 +975,43 @@ constructor(..._: any[]); | ||
declare const instanceOfType: <T extends typeof Class>(cls: T, params?: CustomParams) => ZodType<InstanceType<T>, ZodTypeDef, InstanceType<T>>; | ||
declare const stringType: (params?: RawCreateParams & { | ||
coerce?: true; | ||
}) => ZodString; | ||
declare const numberType: (params?: RawCreateParams & { | ||
coerce?: boolean; | ||
}) => ZodNumber; | ||
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?: RawCreateParams & { | ||
coerce?: boolean; | ||
}) => ZodBigInt; | ||
declare const booleanType: (params?: RawCreateParams & { | ||
coerce?: boolean; | ||
}) => ZodBoolean; | ||
declare const dateType: (params?: RawCreateParams & { | ||
coerce?: boolean; | ||
}) => ZodDate; | ||
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; | ||
@@ -974,5 +1024,5 @@ declare const undefinedType: (params?: RawCreateParams) => ZodUndefined; | ||
declare const voidType: (params?: RawCreateParams) => ZodVoid; | ||
declare const arrayType: <T extends ZodTypeAny>(schema: T, params?: RawCreateParams) => ZodArray<T>; | ||
declare const objectType: <T extends ZodRawShape>(shape: T, params?: RawCreateParams) => ZodObject<T, "strip">; | ||
declare const strictObjectType: <T extends ZodRawShape>(shape: T, params?: RawCreateParams) => ZodObject<T, "strict">; | ||
declare const arrayType: <T extends ZodTypeAny>(schema: T, params?: RawCreateParams) => ZodArray<T, "many">; | ||
declare const objectType: <T extends ZodRawShape>(shape: T, params?: RawCreateParams) => ZodObject<T, "strip", ZodTypeAny, { [k_1 in keyof objectUtil.addQuestionMarks<baseObjectOutputType<T>, { [k in keyof baseObjectOutputType<T>]: undefined extends baseObjectOutputType<T>[k] ? never : k; }[keyof T]>]: objectUtil.addQuestionMarks<baseObjectOutputType<T>, { [k in keyof baseObjectOutputType<T>]: undefined extends baseObjectOutputType<T>[k] ? never : k; }[keyof T]>[k_1]; }, { [k_2 in keyof baseObjectInputType<T>]: baseObjectInputType<T>[k_2]; }>; | ||
declare const strictObjectType: <T extends ZodRawShape>(shape: T, params?: RawCreateParams) => ZodObject<T, "strict", ZodTypeAny, { [k_1 in keyof objectUtil.addQuestionMarks<baseObjectOutputType<T>, { [k in keyof baseObjectOutputType<T>]: undefined extends baseObjectOutputType<T>[k] ? never : k; }[keyof T]>]: objectUtil.addQuestionMarks<baseObjectOutputType<T>, { [k in keyof baseObjectOutputType<T>]: undefined extends baseObjectOutputType<T>[k] ? never : k; }[keyof T]>[k_1]; }, { [k_2 in keyof baseObjectInputType<T>]: baseObjectInputType<T>[k_2]; }>; | ||
declare const unionType: <T extends readonly [ZodTypeAny, ZodTypeAny, ...ZodTypeAny[]]>(types: T, params?: RawCreateParams) => ZodUnion<T>; | ||
@@ -991,3 +1041,3 @@ declare const discriminatedUnionType: typeof ZodDiscriminatedUnion.create; | ||
declare const promiseType: <T extends ZodTypeAny>(schema: T, params?: RawCreateParams) => ZodPromise<T>; | ||
declare const effectsType: <I extends ZodTypeAny>(schema: I, effect: Effect<I["_output"]>, params?: RawCreateParams) => ZodEffects<I, I["_output"]>; | ||
declare const effectsType: <I extends ZodTypeAny>(schema: I, effect: Effect<I["_output"]>, params?: RawCreateParams) => ZodEffects<I, I["_output"], input<I>>; | ||
declare const optionalType: <T extends ZodTypeAny>(type: T, params?: RawCreateParams) => ZodOptional<T>; | ||
@@ -1001,19 +1051,44 @@ declare const nullableType: <T extends ZodTypeAny>(type: T, params?: RawCreateParams) => ZodNullable<T>; | ||
export declare const coerce: { | ||
string: (params?: RawCreateParams & { | ||
coerce?: true; | ||
}) => ZodString; | ||
number: (params?: RawCreateParams & { | ||
coerce?: boolean; | ||
}) => ZodNumber; | ||
boolean: (params?: RawCreateParams & { | ||
coerce?: boolean; | ||
}) => ZodBoolean; | ||
bigint: (params?: RawCreateParams & { | ||
coerce?: boolean; | ||
}) => ZodBigInt; | ||
date: (params?: RawCreateParams & { | ||
coerce?: boolean; | ||
}) => ZodDate; | ||
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; |
import type { TypeOf, ZodType } from "."; | ||
import { Primitive } from "./helpers/typeAliases"; | ||
import { util, ZodParsedType } from "./helpers/util"; | ||
type allKeys<T> = T extends any ? keyof T : never; | ||
export type inferFlattenedErrors<T extends ZodType<any, any, any>, U = string> = typeToFlattenedError<TypeOf<T>, U>; | ||
export type typeToFlattenedError<T, U = string> = { | ||
declare type allKeys<T> = T extends any ? keyof T : never; | ||
export declare type inferFlattenedErrors<T extends ZodType<any, any, any>, U = string> = typeToFlattenedError<TypeOf<T>, U>; | ||
export declare type typeToFlattenedError<T, U = string> = { | ||
formErrors: U[]; | ||
@@ -30,4 +30,4 @@ fieldErrors: { | ||
}; | ||
export type ZodIssueCode = keyof typeof ZodIssueCode; | ||
export type ZodIssueBase = { | ||
export declare type ZodIssueCode = keyof typeof ZodIssueCode; | ||
export declare type ZodIssueBase = { | ||
path: (string | number)[]; | ||
@@ -74,3 +74,3 @@ message?: string; | ||
} | ||
export type StringValidation = "email" | "url" | "emoji" | "uuid" | "regex" | "cuid" | "cuid2" | "ulid" | "datetime" | "ip" | { | ||
export declare type StringValidation = "email" | "url" | "emoji" | "uuid" | "regex" | "cuid" | "cuid2" | "ulid" | "datetime" | "ip" | { | ||
includes: string; | ||
@@ -117,7 +117,7 @@ position?: number; | ||
} | ||
export type DenormalizedError = { | ||
export declare type DenormalizedError = { | ||
[k: string]: DenormalizedError | string[]; | ||
}; | ||
export type ZodIssueOptionalMessage = ZodInvalidTypeIssue | ZodInvalidLiteralIssue | ZodUnrecognizedKeysIssue | ZodInvalidUnionIssue | ZodInvalidUnionDiscriminatorIssue | ZodInvalidEnumValueIssue | ZodInvalidArgumentsIssue | ZodInvalidReturnTypeIssue | ZodInvalidDateIssue | ZodInvalidStringIssue | ZodTooSmallIssue | ZodTooBigIssue | ZodInvalidIntersectionTypesIssue | ZodNotMultipleOfIssue | ZodNotFiniteIssue | ZodCustomIssue; | ||
export type ZodIssue = ZodIssueOptionalMessage & { | ||
export declare type ZodIssueOptionalMessage = ZodInvalidTypeIssue | ZodInvalidLiteralIssue | ZodUnrecognizedKeysIssue | ZodInvalidUnionIssue | ZodInvalidUnionDiscriminatorIssue | ZodInvalidEnumValueIssue | ZodInvalidArgumentsIssue | ZodInvalidReturnTypeIssue | ZodInvalidDateIssue | ZodInvalidStringIssue | ZodTooSmallIssue | ZodTooBigIssue | ZodInvalidIntersectionTypesIssue | ZodNotMultipleOfIssue | ZodNotFiniteIssue | ZodCustomIssue; | ||
export declare type ZodIssue = ZodIssueOptionalMessage & { | ||
fatal?: boolean; | ||
@@ -127,3 +127,3 @@ message: string; | ||
export declare const quotelessJson: (obj: any) => string; | ||
type recursiveZodFormattedError<T> = T extends [any, ...any[]] ? { | ||
declare type recursiveZodFormattedError<T> = T extends [any, ...any[]] ? { | ||
[K in keyof T]?: ZodFormattedError<T[K]>; | ||
@@ -135,6 +135,6 @@ } : T extends any[] ? { | ||
} : unknown; | ||
export type ZodFormattedError<T, U = string> = { | ||
export declare type ZodFormattedError<T, U = string> = { | ||
_errors: U[]; | ||
} & recursiveZodFormattedError<NonNullable<T>>; | ||
export type inferFormattedError<T extends ZodType<any, any, any>, U = string> = ZodFormattedError<TypeOf<T>, U>; | ||
export declare type inferFormattedError<T extends ZodType<any, any, any>, U = string> = ZodFormattedError<TypeOf<T>, U>; | ||
export declare class ZodError<T = any> extends Error { | ||
@@ -156,14 +156,14 @@ issues: ZodIssue[]; | ||
} | ||
type stripPath<T extends object> = T extends any ? util.OmitKeys<T, "path"> : never; | ||
export type IssueData = stripPath<ZodIssueOptionalMessage> & { | ||
declare type stripPath<T extends object> = T extends any ? util.OmitKeys<T, "path"> : never; | ||
export declare type IssueData = stripPath<ZodIssueOptionalMessage> & { | ||
path?: (string | number)[]; | ||
fatal?: boolean; | ||
}; | ||
export type ErrorMapCtx = { | ||
export declare type ErrorMapCtx = { | ||
defaultError: string; | ||
data: any; | ||
}; | ||
export type ZodErrorMap = (issue: ZodIssueOptionalMessage, _ctx: ErrorMapCtx) => { | ||
export declare type ZodErrorMap = (issue: ZodIssueOptionalMessage, _ctx: ErrorMapCtx) => { | ||
message: string; | ||
}; | ||
export {}; |
@@ -29,5 +29,2 @@ "use strict"; | ||
class ZodError extends Error { | ||
get errors() { | ||
return this.issues; | ||
} | ||
constructor(issues) { | ||
@@ -53,2 +50,5 @@ super(); | ||
} | ||
get errors() { | ||
return this.issues; | ||
} | ||
format(_mapper) { | ||
@@ -55,0 +55,0 @@ const mapper = _mapper || |
{ | ||
"name": "zod", | ||
"version": "3.23.0-canary.20240314T051637", | ||
"version": "3.23.0-canary.20240315T001949", | ||
"author": "Colin McDonnell <colin@colinhacks.com>", | ||
@@ -44,3 +44,3 @@ "repository": { | ||
"tsx": "^3.8.0", | ||
"typescript": "~5.4.2", | ||
"typescript": "~4.5.5", | ||
"vitest": "^0.32.2" | ||
@@ -47,0 +47,0 @@ }, |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
634887
14329
2981