@rspack/core 1.3.6 → 1.3.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (39) hide show
  1. package/compiled/graceful-fs/index.js +8 -8
  2. package/compiled/zod/index.d.ts +2 -1772
  3. package/compiled/zod/lib/ZodError.d.ts +164 -0
  4. package/compiled/zod/lib/__tests__/Mocker.d.ts +17 -0
  5. package/compiled/zod/lib/benchmarks/datetime.d.ts +5 -0
  6. package/compiled/zod/lib/benchmarks/discriminatedUnion.d.ts +5 -0
  7. package/compiled/zod/lib/benchmarks/index.d.ts +1 -0
  8. package/compiled/zod/lib/benchmarks/ipv4.d.ts +5 -0
  9. package/compiled/zod/lib/benchmarks/object.d.ts +5 -0
  10. package/compiled/zod/lib/benchmarks/primitives.d.ts +5 -0
  11. package/compiled/zod/lib/benchmarks/realworld.d.ts +5 -0
  12. package/compiled/zod/lib/benchmarks/string.d.ts +5 -0
  13. package/compiled/zod/lib/benchmarks/union.d.ts +5 -0
  14. package/compiled/zod/lib/errors.d.ts +5 -0
  15. package/compiled/zod/lib/external.d.ts +6 -0
  16. package/compiled/zod/lib/helpers/enumUtil.d.ts +8 -0
  17. package/compiled/zod/lib/helpers/errorUtil.d.ts +9 -0
  18. package/compiled/zod/lib/helpers/parseUtil.d.ts +78 -0
  19. package/compiled/zod/lib/helpers/partialUtil.d.ts +8 -0
  20. package/compiled/zod/lib/helpers/typeAliases.d.ts +2 -0
  21. package/compiled/zod/lib/helpers/util.d.ts +82 -0
  22. package/compiled/zod/lib/index.d.ts +4 -0
  23. package/compiled/zod/lib/locales/en.d.ts +3 -0
  24. package/compiled/zod/lib/standard-schema.d.ts +102 -0
  25. package/compiled/zod/lib/types.d.ts +1062 -0
  26. package/compiled/zod/package.json +1 -1
  27. package/dist/ChunkGroup.d.ts +10 -0
  28. package/dist/RspackError.d.ts +2 -1
  29. package/dist/builtin-loader/swc/pluginImport.d.ts +1 -1
  30. package/dist/builtin-loader/swc/types.d.ts +632 -631
  31. package/dist/builtin-plugin/CircularDependencyRspackPlugin.d.ts +14 -14
  32. package/dist/config/types.d.ts +15 -2
  33. package/dist/config/utils.d.ts +1 -1
  34. package/dist/config/zod.d.ts +84 -77
  35. package/dist/exports.d.ts +6 -0
  36. package/dist/index.js +676 -604
  37. package/dist/swc.d.ts +5 -0
  38. package/dist/trace/index.d.ts +2 -0
  39. package/package.json +3 -3
@@ -0,0 +1,1062 @@
1
+ import { enumUtil } from "./helpers/enumUtil";
2
+ import { errorUtil } from "./helpers/errorUtil";
3
+ import { AsyncParseReturnType, INVALID, ParseContext, ParseInput, ParseParams, ParseReturnType, ParseStatus, SyncParseReturnType } from "./helpers/parseUtil";
4
+ import { partialUtil } from "./helpers/partialUtil";
5
+ import { Primitive } from "./helpers/typeAliases";
6
+ import { objectUtil, util } from "./helpers/util";
7
+ import type { StandardSchemaV1 } from "./standard-schema";
8
+ import { IssueData, StringValidation, ZodCustomIssue, ZodError, ZodErrorMap } from "./ZodError";
9
+ export interface RefinementCtx {
10
+ addIssue: (arg: IssueData) => void;
11
+ path: (string | number)[];
12
+ }
13
+ export type ZodRawShape = {
14
+ [k: string]: ZodTypeAny;
15
+ };
16
+ export type ZodTypeAny = ZodType<any, any, any>;
17
+ export type TypeOf<T extends ZodType<any, any, any>> = T["_output"];
18
+ export type input<T extends ZodType<any, any, any>> = T["_input"];
19
+ export type output<T extends ZodType<any, any, any>> = T["_output"];
20
+ export type { TypeOf as infer };
21
+ export type CustomErrorParams = Partial<util.Omit<ZodCustomIssue, "code">>;
22
+ export interface ZodTypeDef {
23
+ errorMap?: ZodErrorMap;
24
+ description?: string;
25
+ }
26
+ export type RawCreateParams = {
27
+ errorMap?: ZodErrorMap;
28
+ invalid_type_error?: string;
29
+ required_error?: string;
30
+ message?: string;
31
+ description?: string;
32
+ } | undefined;
33
+ export type ProcessedCreateParams = {
34
+ errorMap?: ZodErrorMap;
35
+ description?: string;
36
+ };
37
+ export type SafeParseSuccess<Output> = {
38
+ success: true;
39
+ data: Output;
40
+ error?: never;
41
+ };
42
+ export type SafeParseError<Input> = {
43
+ success: false;
44
+ error: ZodError<Input>;
45
+ data?: never;
46
+ };
47
+ export type SafeParseReturnType<Input, Output> = SafeParseSuccess<Output> | SafeParseError<Input>;
48
+ export declare abstract class ZodType<Output = any, Def extends ZodTypeDef = ZodTypeDef, Input = Output> {
49
+ readonly _type: Output;
50
+ readonly _output: Output;
51
+ readonly _input: Input;
52
+ readonly _def: Def;
53
+ get description(): string | undefined;
54
+ "~standard": StandardSchemaV1.Props<Input, Output>;
55
+ abstract _parse(input: ParseInput): ParseReturnType<Output>;
56
+ _getType(input: ParseInput): string;
57
+ _getOrReturnCtx(input: ParseInput, ctx?: ParseContext | undefined): ParseContext;
58
+ _processInputParams(input: ParseInput): {
59
+ status: ParseStatus;
60
+ ctx: ParseContext;
61
+ };
62
+ _parseSync(input: ParseInput): SyncParseReturnType<Output>;
63
+ _parseAsync(input: ParseInput): AsyncParseReturnType<Output>;
64
+ parse(data: unknown, params?: Partial<ParseParams>): Output;
65
+ safeParse(data: unknown, params?: Partial<ParseParams>): SafeParseReturnType<Input, Output>;
66
+ "~validate"(data: unknown): StandardSchemaV1.Result<Output> | Promise<StandardSchemaV1.Result<Output>>;
67
+ parseAsync(data: unknown, params?: Partial<ParseParams>): Promise<Output>;
68
+ safeParseAsync(data: unknown, params?: Partial<ParseParams>): Promise<SafeParseReturnType<Input, Output>>;
69
+ /** Alias of safeParseAsync */
70
+ spa: (data: unknown, params?: Partial<ParseParams>) => Promise<SafeParseReturnType<Input, Output>>;
71
+ refine<RefinedOutput extends Output>(check: (arg: Output) => arg is RefinedOutput, message?: string | CustomErrorParams | ((arg: Output) => CustomErrorParams)): ZodEffects<this, RefinedOutput, Input>;
72
+ refine(check: (arg: Output) => unknown | Promise<unknown>, message?: string | CustomErrorParams | ((arg: Output) => CustomErrorParams)): ZodEffects<this, Output, Input>;
73
+ refinement<RefinedOutput extends Output>(check: (arg: Output) => arg is RefinedOutput, refinementData: IssueData | ((arg: Output, ctx: RefinementCtx) => IssueData)): ZodEffects<this, RefinedOutput, Input>;
74
+ refinement(check: (arg: Output) => boolean, refinementData: IssueData | ((arg: Output, ctx: RefinementCtx) => IssueData)): ZodEffects<this, Output, Input>;
75
+ _refinement(refinement: RefinementEffect<Output>["refinement"]): ZodEffects<this, Output, Input>;
76
+ superRefine<RefinedOutput extends Output>(refinement: (arg: Output, ctx: RefinementCtx) => arg is RefinedOutput): ZodEffects<this, RefinedOutput, Input>;
77
+ superRefine(refinement: (arg: Output, ctx: RefinementCtx) => void): ZodEffects<this, Output, Input>;
78
+ superRefine(refinement: (arg: Output, ctx: RefinementCtx) => Promise<void>): ZodEffects<this, Output, Input>;
79
+ constructor(def: Def);
80
+ optional(): ZodOptional<this>;
81
+ nullable(): ZodNullable<this>;
82
+ nullish(): ZodOptional<ZodNullable<this>>;
83
+ array(): ZodArray<this>;
84
+ promise(): ZodPromise<this>;
85
+ or<T extends ZodTypeAny>(option: T): ZodUnion<[this, T]>;
86
+ and<T extends ZodTypeAny>(incoming: T): ZodIntersection<this, T>;
87
+ transform<NewOut>(transform: (arg: Output, ctx: RefinementCtx) => NewOut | Promise<NewOut>): ZodEffects<this, NewOut>;
88
+ default(def: util.noUndefined<Input>): ZodDefault<this>;
89
+ default(def: () => util.noUndefined<Input>): ZodDefault<this>;
90
+ brand<B extends string | number | symbol>(brand?: B): ZodBranded<this, B>;
91
+ catch(def: Output): ZodCatch<this>;
92
+ catch(def: (ctx: {
93
+ error: ZodError;
94
+ input: Input;
95
+ }) => Output): ZodCatch<this>;
96
+ describe(description: string): this;
97
+ pipe<T extends ZodTypeAny>(target: T): ZodPipeline<this, T>;
98
+ readonly(): ZodReadonly<this>;
99
+ isOptional(): boolean;
100
+ isNullable(): boolean;
101
+ }
102
+ export type IpVersion = "v4" | "v6";
103
+ export type ZodStringCheck = {
104
+ kind: "min";
105
+ value: number;
106
+ message?: string;
107
+ } | {
108
+ kind: "max";
109
+ value: number;
110
+ message?: string;
111
+ } | {
112
+ kind: "length";
113
+ value: number;
114
+ message?: string;
115
+ } | {
116
+ kind: "email";
117
+ message?: string;
118
+ } | {
119
+ kind: "url";
120
+ message?: string;
121
+ } | {
122
+ kind: "emoji";
123
+ message?: string;
124
+ } | {
125
+ kind: "uuid";
126
+ message?: string;
127
+ } | {
128
+ kind: "nanoid";
129
+ message?: string;
130
+ } | {
131
+ kind: "cuid";
132
+ message?: string;
133
+ } | {
134
+ kind: "includes";
135
+ value: string;
136
+ position?: number;
137
+ message?: string;
138
+ } | {
139
+ kind: "cuid2";
140
+ message?: string;
141
+ } | {
142
+ kind: "ulid";
143
+ message?: string;
144
+ } | {
145
+ kind: "startsWith";
146
+ value: string;
147
+ message?: string;
148
+ } | {
149
+ kind: "endsWith";
150
+ value: string;
151
+ message?: string;
152
+ } | {
153
+ kind: "regex";
154
+ regex: RegExp;
155
+ message?: string;
156
+ } | {
157
+ kind: "trim";
158
+ message?: string;
159
+ } | {
160
+ kind: "toLowerCase";
161
+ message?: string;
162
+ } | {
163
+ kind: "toUpperCase";
164
+ message?: string;
165
+ } | {
166
+ kind: "jwt";
167
+ alg?: string;
168
+ message?: string;
169
+ } | {
170
+ kind: "datetime";
171
+ offset: boolean;
172
+ local: boolean;
173
+ precision: number | null;
174
+ message?: string;
175
+ } | {
176
+ kind: "date";
177
+ message?: string;
178
+ } | {
179
+ kind: "time";
180
+ precision: number | null;
181
+ message?: string;
182
+ } | {
183
+ kind: "duration";
184
+ message?: string;
185
+ } | {
186
+ kind: "ip";
187
+ version?: IpVersion;
188
+ message?: string;
189
+ } | {
190
+ kind: "cidr";
191
+ version?: IpVersion;
192
+ message?: string;
193
+ } | {
194
+ kind: "base64";
195
+ message?: string;
196
+ } | {
197
+ kind: "base64url";
198
+ message?: string;
199
+ };
200
+ export interface ZodStringDef extends ZodTypeDef {
201
+ checks: ZodStringCheck[];
202
+ typeName: ZodFirstPartyTypeKind.ZodString;
203
+ coerce: boolean;
204
+ }
205
+ export declare function datetimeRegex(args: {
206
+ precision?: number | null;
207
+ offset?: boolean;
208
+ local?: boolean;
209
+ }): RegExp;
210
+ export declare class ZodString extends ZodType<string, ZodStringDef, string> {
211
+ _parse(input: ParseInput): ParseReturnType<string>;
212
+ protected _regex(regex: RegExp, validation: StringValidation, message?: errorUtil.ErrMessage): ZodEffects<this, string, string>;
213
+ _addCheck(check: ZodStringCheck): ZodString;
214
+ email(message?: errorUtil.ErrMessage): ZodString;
215
+ url(message?: errorUtil.ErrMessage): ZodString;
216
+ emoji(message?: errorUtil.ErrMessage): ZodString;
217
+ uuid(message?: errorUtil.ErrMessage): ZodString;
218
+ nanoid(message?: errorUtil.ErrMessage): ZodString;
219
+ cuid(message?: errorUtil.ErrMessage): ZodString;
220
+ cuid2(message?: errorUtil.ErrMessage): ZodString;
221
+ ulid(message?: errorUtil.ErrMessage): ZodString;
222
+ base64(message?: errorUtil.ErrMessage): ZodString;
223
+ base64url(message?: errorUtil.ErrMessage): ZodString;
224
+ jwt(options?: {
225
+ alg?: string;
226
+ message?: string;
227
+ }): ZodString;
228
+ ip(options?: string | {
229
+ version?: IpVersion;
230
+ message?: string;
231
+ }): ZodString;
232
+ cidr(options?: string | {
233
+ version?: IpVersion;
234
+ message?: string;
235
+ }): ZodString;
236
+ datetime(options?: string | {
237
+ message?: string | undefined;
238
+ precision?: number | null;
239
+ offset?: boolean;
240
+ local?: boolean;
241
+ }): ZodString;
242
+ date(message?: string): ZodString;
243
+ time(options?: string | {
244
+ message?: string | undefined;
245
+ precision?: number | null;
246
+ }): ZodString;
247
+ duration(message?: errorUtil.ErrMessage): ZodString;
248
+ regex(regex: RegExp, message?: errorUtil.ErrMessage): ZodString;
249
+ includes(value: string, options?: {
250
+ message?: string;
251
+ position?: number;
252
+ }): ZodString;
253
+ startsWith(value: string, message?: errorUtil.ErrMessage): ZodString;
254
+ endsWith(value: string, message?: errorUtil.ErrMessage): ZodString;
255
+ min(minLength: number, message?: errorUtil.ErrMessage): ZodString;
256
+ max(maxLength: number, message?: errorUtil.ErrMessage): ZodString;
257
+ length(len: number, message?: errorUtil.ErrMessage): ZodString;
258
+ /**
259
+ * Equivalent to `.min(1)`
260
+ */
261
+ nonempty(message?: errorUtil.ErrMessage): ZodString;
262
+ trim(): ZodString;
263
+ toLowerCase(): ZodString;
264
+ toUpperCase(): ZodString;
265
+ get isDatetime(): boolean;
266
+ get isDate(): boolean;
267
+ get isTime(): boolean;
268
+ get isDuration(): boolean;
269
+ get isEmail(): boolean;
270
+ get isURL(): boolean;
271
+ get isEmoji(): boolean;
272
+ get isUUID(): boolean;
273
+ get isNANOID(): boolean;
274
+ get isCUID(): boolean;
275
+ get isCUID2(): boolean;
276
+ get isULID(): boolean;
277
+ get isIP(): boolean;
278
+ get isCIDR(): boolean;
279
+ get isBase64(): boolean;
280
+ get isBase64url(): boolean;
281
+ get minLength(): number | null;
282
+ get maxLength(): number | null;
283
+ static create: (params?: RawCreateParams & {
284
+ coerce?: true;
285
+ }) => ZodString;
286
+ }
287
+ export type ZodNumberCheck = {
288
+ kind: "min";
289
+ value: number;
290
+ inclusive: boolean;
291
+ message?: string;
292
+ } | {
293
+ kind: "max";
294
+ value: number;
295
+ inclusive: boolean;
296
+ message?: string;
297
+ } | {
298
+ kind: "int";
299
+ message?: string;
300
+ } | {
301
+ kind: "multipleOf";
302
+ value: number;
303
+ message?: string;
304
+ } | {
305
+ kind: "finite";
306
+ message?: string;
307
+ };
308
+ export interface ZodNumberDef extends ZodTypeDef {
309
+ checks: ZodNumberCheck[];
310
+ typeName: ZodFirstPartyTypeKind.ZodNumber;
311
+ coerce: boolean;
312
+ }
313
+ export declare class ZodNumber extends ZodType<number, ZodNumberDef, number> {
314
+ _parse(input: ParseInput): ParseReturnType<number>;
315
+ static create: (params?: RawCreateParams & {
316
+ coerce?: boolean;
317
+ }) => ZodNumber;
318
+ gte(value: number, message?: errorUtil.ErrMessage): ZodNumber;
319
+ min: (value: number, message?: errorUtil.ErrMessage) => ZodNumber;
320
+ gt(value: number, message?: errorUtil.ErrMessage): ZodNumber;
321
+ lte(value: number, message?: errorUtil.ErrMessage): ZodNumber;
322
+ max: (value: number, message?: errorUtil.ErrMessage) => ZodNumber;
323
+ lt(value: number, message?: errorUtil.ErrMessage): ZodNumber;
324
+ protected setLimit(kind: "min" | "max", value: number, inclusive: boolean, message?: string): ZodNumber;
325
+ _addCheck(check: ZodNumberCheck): ZodNumber;
326
+ int(message?: errorUtil.ErrMessage): ZodNumber;
327
+ positive(message?: errorUtil.ErrMessage): ZodNumber;
328
+ negative(message?: errorUtil.ErrMessage): ZodNumber;
329
+ nonpositive(message?: errorUtil.ErrMessage): ZodNumber;
330
+ nonnegative(message?: errorUtil.ErrMessage): ZodNumber;
331
+ multipleOf(value: number, message?: errorUtil.ErrMessage): ZodNumber;
332
+ step: (value: number, message?: errorUtil.ErrMessage) => ZodNumber;
333
+ finite(message?: errorUtil.ErrMessage): ZodNumber;
334
+ safe(message?: errorUtil.ErrMessage): ZodNumber;
335
+ get minValue(): number | null;
336
+ get maxValue(): number | null;
337
+ get isInt(): boolean;
338
+ get isFinite(): boolean;
339
+ }
340
+ export type ZodBigIntCheck = {
341
+ kind: "min";
342
+ value: bigint;
343
+ inclusive: boolean;
344
+ message?: string;
345
+ } | {
346
+ kind: "max";
347
+ value: bigint;
348
+ inclusive: boolean;
349
+ message?: string;
350
+ } | {
351
+ kind: "multipleOf";
352
+ value: bigint;
353
+ message?: string;
354
+ };
355
+ export interface ZodBigIntDef extends ZodTypeDef {
356
+ checks: ZodBigIntCheck[];
357
+ typeName: ZodFirstPartyTypeKind.ZodBigInt;
358
+ coerce: boolean;
359
+ }
360
+ export declare class ZodBigInt extends ZodType<bigint, ZodBigIntDef, bigint> {
361
+ _parse(input: ParseInput): ParseReturnType<bigint>;
362
+ _getInvalidInput(input: ParseInput): INVALID;
363
+ static create: (params?: RawCreateParams & {
364
+ coerce?: boolean;
365
+ }) => ZodBigInt;
366
+ gte(value: bigint, message?: errorUtil.ErrMessage): ZodBigInt;
367
+ min: (value: bigint, message?: errorUtil.ErrMessage) => ZodBigInt;
368
+ gt(value: bigint, message?: errorUtil.ErrMessage): ZodBigInt;
369
+ lte(value: bigint, message?: errorUtil.ErrMessage): ZodBigInt;
370
+ max: (value: bigint, message?: errorUtil.ErrMessage) => ZodBigInt;
371
+ lt(value: bigint, message?: errorUtil.ErrMessage): ZodBigInt;
372
+ protected setLimit(kind: "min" | "max", value: bigint, inclusive: boolean, message?: string): ZodBigInt;
373
+ _addCheck(check: ZodBigIntCheck): ZodBigInt;
374
+ positive(message?: errorUtil.ErrMessage): ZodBigInt;
375
+ negative(message?: errorUtil.ErrMessage): ZodBigInt;
376
+ nonpositive(message?: errorUtil.ErrMessage): ZodBigInt;
377
+ nonnegative(message?: errorUtil.ErrMessage): ZodBigInt;
378
+ multipleOf(value: bigint, message?: errorUtil.ErrMessage): ZodBigInt;
379
+ get minValue(): bigint | null;
380
+ get maxValue(): bigint | null;
381
+ }
382
+ export interface ZodBooleanDef extends ZodTypeDef {
383
+ typeName: ZodFirstPartyTypeKind.ZodBoolean;
384
+ coerce: boolean;
385
+ }
386
+ export declare class ZodBoolean extends ZodType<boolean, ZodBooleanDef, boolean> {
387
+ _parse(input: ParseInput): ParseReturnType<boolean>;
388
+ static create: (params?: RawCreateParams & {
389
+ coerce?: boolean;
390
+ }) => ZodBoolean;
391
+ }
392
+ export type ZodDateCheck = {
393
+ kind: "min";
394
+ value: number;
395
+ message?: string;
396
+ } | {
397
+ kind: "max";
398
+ value: number;
399
+ message?: string;
400
+ };
401
+ export interface ZodDateDef extends ZodTypeDef {
402
+ checks: ZodDateCheck[];
403
+ coerce: boolean;
404
+ typeName: ZodFirstPartyTypeKind.ZodDate;
405
+ }
406
+ export declare class ZodDate extends ZodType<Date, ZodDateDef, Date> {
407
+ _parse(input: ParseInput): ParseReturnType<this["_output"]>;
408
+ _addCheck(check: ZodDateCheck): ZodDate;
409
+ min(minDate: Date, message?: errorUtil.ErrMessage): ZodDate;
410
+ max(maxDate: Date, message?: errorUtil.ErrMessage): ZodDate;
411
+ get minDate(): Date | null;
412
+ get maxDate(): Date | null;
413
+ static create: (params?: RawCreateParams & {
414
+ coerce?: boolean;
415
+ }) => ZodDate;
416
+ }
417
+ export interface ZodSymbolDef extends ZodTypeDef {
418
+ typeName: ZodFirstPartyTypeKind.ZodSymbol;
419
+ }
420
+ export declare class ZodSymbol extends ZodType<symbol, ZodSymbolDef, symbol> {
421
+ _parse(input: ParseInput): ParseReturnType<this["_output"]>;
422
+ static create: (params?: RawCreateParams) => ZodSymbol;
423
+ }
424
+ export interface ZodUndefinedDef extends ZodTypeDef {
425
+ typeName: ZodFirstPartyTypeKind.ZodUndefined;
426
+ }
427
+ export declare class ZodUndefined extends ZodType<undefined, ZodUndefinedDef, undefined> {
428
+ _parse(input: ParseInput): ParseReturnType<this["_output"]>;
429
+ params?: RawCreateParams;
430
+ static create: (params?: RawCreateParams) => ZodUndefined;
431
+ }
432
+ export interface ZodNullDef extends ZodTypeDef {
433
+ typeName: ZodFirstPartyTypeKind.ZodNull;
434
+ }
435
+ export declare class ZodNull extends ZodType<null, ZodNullDef, null> {
436
+ _parse(input: ParseInput): ParseReturnType<this["_output"]>;
437
+ static create: (params?: RawCreateParams) => ZodNull;
438
+ }
439
+ export interface ZodAnyDef extends ZodTypeDef {
440
+ typeName: ZodFirstPartyTypeKind.ZodAny;
441
+ }
442
+ export declare class ZodAny extends ZodType<any, ZodAnyDef, any> {
443
+ _any: true;
444
+ _parse(input: ParseInput): ParseReturnType<this["_output"]>;
445
+ static create: (params?: RawCreateParams) => ZodAny;
446
+ }
447
+ export interface ZodUnknownDef extends ZodTypeDef {
448
+ typeName: ZodFirstPartyTypeKind.ZodUnknown;
449
+ }
450
+ export declare class ZodUnknown extends ZodType<unknown, ZodUnknownDef, unknown> {
451
+ _unknown: true;
452
+ _parse(input: ParseInput): ParseReturnType<this["_output"]>;
453
+ static create: (params?: RawCreateParams) => ZodUnknown;
454
+ }
455
+ export interface ZodNeverDef extends ZodTypeDef {
456
+ typeName: ZodFirstPartyTypeKind.ZodNever;
457
+ }
458
+ export declare class ZodNever extends ZodType<never, ZodNeverDef, never> {
459
+ _parse(input: ParseInput): ParseReturnType<this["_output"]>;
460
+ static create: (params?: RawCreateParams) => ZodNever;
461
+ }
462
+ export interface ZodVoidDef extends ZodTypeDef {
463
+ typeName: ZodFirstPartyTypeKind.ZodVoid;
464
+ }
465
+ export declare class ZodVoid extends ZodType<void, ZodVoidDef, void> {
466
+ _parse(input: ParseInput): ParseReturnType<this["_output"]>;
467
+ static create: (params?: RawCreateParams) => ZodVoid;
468
+ }
469
+ export interface ZodArrayDef<T extends ZodTypeAny = ZodTypeAny> extends ZodTypeDef {
470
+ type: T;
471
+ typeName: ZodFirstPartyTypeKind.ZodArray;
472
+ exactLength: {
473
+ value: number;
474
+ message?: string;
475
+ } | null;
476
+ minLength: {
477
+ value: number;
478
+ message?: string;
479
+ } | null;
480
+ maxLength: {
481
+ value: number;
482
+ message?: string;
483
+ } | null;
484
+ }
485
+ export type ArrayCardinality = "many" | "atleastone";
486
+ export type arrayOutputType<T extends ZodTypeAny, Cardinality extends ArrayCardinality = "many"> = Cardinality extends "atleastone" ? [T["_output"], ...T["_output"][]] : T["_output"][];
487
+ 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"][]> {
488
+ _parse(input: ParseInput): ParseReturnType<this["_output"]>;
489
+ get element(): T;
490
+ min(minLength: number, message?: errorUtil.ErrMessage): this;
491
+ max(maxLength: number, message?: errorUtil.ErrMessage): this;
492
+ length(len: number, message?: errorUtil.ErrMessage): this;
493
+ nonempty(message?: errorUtil.ErrMessage): ZodArray<T, "atleastone">;
494
+ static create: <T_1 extends ZodTypeAny>(schema: T_1, params?: RawCreateParams) => ZodArray<T_1, "many">;
495
+ }
496
+ export type ZodNonEmptyArray<T extends ZodTypeAny> = ZodArray<T, "atleastone">;
497
+ export type UnknownKeysParam = "passthrough" | "strict" | "strip";
498
+ export interface ZodObjectDef<T extends ZodRawShape = ZodRawShape, UnknownKeys extends UnknownKeysParam = UnknownKeysParam, Catchall extends ZodTypeAny = ZodTypeAny> extends ZodTypeDef {
499
+ typeName: ZodFirstPartyTypeKind.ZodObject;
500
+ shape: () => T;
501
+ catchall: Catchall;
502
+ unknownKeys: UnknownKeys;
503
+ }
504
+ export type mergeTypes<A, B> = {
505
+ [k in keyof A | keyof B]: k extends keyof B ? B[k] : k extends keyof A ? A[k] : never;
506
+ };
507
+ export type objectOutputType<Shape extends ZodRawShape, Catchall extends ZodTypeAny, UnknownKeys extends UnknownKeysParam = UnknownKeysParam> = objectUtil.flatten<objectUtil.addQuestionMarks<baseObjectOutputType<Shape>>> & CatchallOutput<Catchall> & PassthroughType<UnknownKeys>;
508
+ export type baseObjectOutputType<Shape extends ZodRawShape> = {
509
+ [k in keyof Shape]: Shape[k]["_output"];
510
+ };
511
+ export type objectInputType<Shape extends ZodRawShape, Catchall extends ZodTypeAny, UnknownKeys extends UnknownKeysParam = UnknownKeysParam> = objectUtil.flatten<baseObjectInputType<Shape>> & CatchallInput<Catchall> & PassthroughType<UnknownKeys>;
512
+ export type baseObjectInputType<Shape extends ZodRawShape> = objectUtil.addQuestionMarks<{
513
+ [k in keyof Shape]: Shape[k]["_input"];
514
+ }>;
515
+ export type CatchallOutput<T extends ZodType> = ZodType extends T ? unknown : {
516
+ [k: string]: T["_output"];
517
+ };
518
+ export type CatchallInput<T extends ZodType> = ZodType extends T ? unknown : {
519
+ [k: string]: T["_input"];
520
+ };
521
+ export type PassthroughType<T extends UnknownKeysParam> = T extends "passthrough" ? {
522
+ [k: string]: unknown;
523
+ } : unknown;
524
+ export type deoptional<T extends ZodTypeAny> = T extends ZodOptional<infer U> ? deoptional<U> : T extends ZodNullable<infer U> ? ZodNullable<deoptional<U>> : T;
525
+ export type SomeZodObject = ZodObject<ZodRawShape, UnknownKeysParam, ZodTypeAny>;
526
+ export type noUnrecognized<Obj extends object, Shape extends object> = {
527
+ [k in keyof Obj]: k extends keyof Shape ? Obj[k] : never;
528
+ };
529
+ export declare class ZodObject<T extends ZodRawShape, UnknownKeys extends UnknownKeysParam = UnknownKeysParam, Catchall extends ZodTypeAny = ZodTypeAny, Output = objectOutputType<T, Catchall, UnknownKeys>, Input = objectInputType<T, Catchall, UnknownKeys>> extends ZodType<Output, ZodObjectDef<T, UnknownKeys, Catchall>, Input> {
530
+ private _cached;
531
+ _getCached(): {
532
+ shape: T;
533
+ keys: string[];
534
+ };
535
+ _parse(input: ParseInput): ParseReturnType<this["_output"]>;
536
+ get shape(): T;
537
+ strict(message?: errorUtil.ErrMessage): ZodObject<T, "strict", Catchall>;
538
+ strip(): ZodObject<T, "strip", Catchall>;
539
+ passthrough(): ZodObject<T, "passthrough", Catchall>;
540
+ /**
541
+ * @deprecated In most cases, this is no longer needed - unknown properties are now silently stripped.
542
+ * If you want to pass through unknown properties, use `.passthrough()` instead.
543
+ */
544
+ nonstrict: () => ZodObject<T, "passthrough", Catchall>;
545
+ extend<Augmentation extends ZodRawShape>(augmentation: Augmentation): ZodObject<objectUtil.extendShape<T, Augmentation>, UnknownKeys, Catchall>;
546
+ /**
547
+ * @deprecated Use `.extend` instead
548
+ * */
549
+ augment: <Augmentation extends ZodRawShape>(augmentation: Augmentation) => ZodObject<objectUtil.extendShape<T, Augmentation>, UnknownKeys, Catchall>;
550
+ /**
551
+ * Prior to zod@1.0.12 there was a bug in the
552
+ * inferred type of merged objects. Please
553
+ * upgrade if you are experiencing issues.
554
+ */
555
+ merge<Incoming extends AnyZodObject, Augmentation extends Incoming["shape"]>(merging: Incoming): ZodObject<objectUtil.extendShape<T, Augmentation>, Incoming["_def"]["unknownKeys"], Incoming["_def"]["catchall"]>;
556
+ setKey<Key extends string, Schema extends ZodTypeAny>(key: Key, schema: Schema): ZodObject<T & {
557
+ [k in Key]: Schema;
558
+ }, UnknownKeys, Catchall>;
559
+ catchall<Index extends ZodTypeAny>(index: Index): ZodObject<T, UnknownKeys, Index>;
560
+ pick<Mask extends util.Exactly<{
561
+ [k in keyof T]?: true;
562
+ }, Mask>>(mask: Mask): ZodObject<Pick<T, Extract<keyof T, keyof Mask>>, UnknownKeys, Catchall>;
563
+ omit<Mask extends util.Exactly<{
564
+ [k in keyof T]?: true;
565
+ }, Mask>>(mask: Mask): ZodObject<Omit<T, keyof Mask>, UnknownKeys, Catchall>;
566
+ /**
567
+ * @deprecated
568
+ */
569
+ deepPartial(): partialUtil.DeepPartial<this>;
570
+ partial(): ZodObject<{
571
+ [k in keyof T]: ZodOptional<T[k]>;
572
+ }, UnknownKeys, Catchall>;
573
+ partial<Mask extends util.Exactly<{
574
+ [k in keyof T]?: true;
575
+ }, Mask>>(mask: Mask): ZodObject<objectUtil.noNever<{
576
+ [k in keyof T]: k extends keyof Mask ? ZodOptional<T[k]> : T[k];
577
+ }>, UnknownKeys, Catchall>;
578
+ required(): ZodObject<{
579
+ [k in keyof T]: deoptional<T[k]>;
580
+ }, UnknownKeys, Catchall>;
581
+ required<Mask extends util.Exactly<{
582
+ [k in keyof T]?: true;
583
+ }, Mask>>(mask: Mask): ZodObject<objectUtil.noNever<{
584
+ [k in keyof T]: k extends keyof Mask ? deoptional<T[k]> : T[k];
585
+ }>, UnknownKeys, Catchall>;
586
+ keyof(): ZodEnum<enumUtil.UnionToTupleString<keyof T>>;
587
+ static create: <T_1 extends ZodRawShape>(shape: T_1, params?: RawCreateParams) => ZodObject<T_1, "strip", ZodTypeAny, objectUtil.addQuestionMarks<baseObjectOutputType<T_1>, any> extends infer T_2 ? { [k in keyof T_2]: objectUtil.addQuestionMarks<baseObjectOutputType<T_1>, any>[k]; } : never, baseObjectInputType<T_1> extends infer T_3 ? { [k_1 in keyof T_3]: baseObjectInputType<T_1>[k_1]; } : never>;
588
+ static strictCreate: <T_1 extends ZodRawShape>(shape: T_1, params?: RawCreateParams) => ZodObject<T_1, "strict", ZodTypeAny, objectUtil.addQuestionMarks<baseObjectOutputType<T_1>, any> extends infer T_2 ? { [k in keyof T_2]: objectUtil.addQuestionMarks<baseObjectOutputType<T_1>, any>[k]; } : never, baseObjectInputType<T_1> extends infer T_3 ? { [k_1 in keyof T_3]: baseObjectInputType<T_1>[k_1]; } : never>;
589
+ static lazycreate: <T_1 extends ZodRawShape>(shape: () => T_1, params?: RawCreateParams) => ZodObject<T_1, "strip", ZodTypeAny, objectUtil.addQuestionMarks<baseObjectOutputType<T_1>, any> extends infer T_2 ? { [k in keyof T_2]: objectUtil.addQuestionMarks<baseObjectOutputType<T_1>, any>[k]; } : never, baseObjectInputType<T_1> extends infer T_3 ? { [k_1 in keyof T_3]: baseObjectInputType<T_1>[k_1]; } : never>;
590
+ }
591
+ export type AnyZodObject = ZodObject<any, any, any>;
592
+ export type ZodUnionOptions = Readonly<[ZodTypeAny, ...ZodTypeAny[]]>;
593
+ export interface ZodUnionDef<T extends ZodUnionOptions = Readonly<[
594
+ ZodTypeAny,
595
+ ZodTypeAny,
596
+ ...ZodTypeAny[]
597
+ ]>> extends ZodTypeDef {
598
+ options: T;
599
+ typeName: ZodFirstPartyTypeKind.ZodUnion;
600
+ }
601
+ export declare class ZodUnion<T extends ZodUnionOptions> extends ZodType<T[number]["_output"], ZodUnionDef<T>, T[number]["_input"]> {
602
+ _parse(input: ParseInput): ParseReturnType<this["_output"]>;
603
+ get options(): T;
604
+ static create: <T_1 extends readonly [ZodTypeAny, ZodTypeAny, ...ZodTypeAny[]]>(types: T_1, params?: RawCreateParams) => ZodUnion<T_1>;
605
+ }
606
+ export type ZodDiscriminatedUnionOption<Discriminator extends string> = ZodObject<{
607
+ [key in Discriminator]: ZodTypeAny;
608
+ } & ZodRawShape, UnknownKeysParam, ZodTypeAny>;
609
+ export interface ZodDiscriminatedUnionDef<Discriminator extends string, Options extends readonly ZodDiscriminatedUnionOption<string>[] = ZodDiscriminatedUnionOption<string>[]> extends ZodTypeDef {
610
+ discriminator: Discriminator;
611
+ options: Options;
612
+ optionsMap: Map<Primitive, ZodDiscriminatedUnionOption<any>>;
613
+ typeName: ZodFirstPartyTypeKind.ZodDiscriminatedUnion;
614
+ }
615
+ export declare class ZodDiscriminatedUnion<Discriminator extends string, Options extends readonly ZodDiscriminatedUnionOption<Discriminator>[]> extends ZodType<output<Options[number]>, ZodDiscriminatedUnionDef<Discriminator, Options>, input<Options[number]>> {
616
+ _parse(input: ParseInput): ParseReturnType<this["_output"]>;
617
+ get discriminator(): Discriminator;
618
+ get options(): Options;
619
+ get optionsMap(): Map<Primitive, ZodDiscriminatedUnionOption<any>>;
620
+ /**
621
+ * The constructor of the discriminated union schema. Its behaviour is very similar to that of the normal z.union() constructor.
622
+ * However, it only allows a union of objects, all of which need to share a discriminator property. This property must
623
+ * have a different value for each object in the union.
624
+ * @param discriminator the name of the discriminator property
625
+ * @param types an array of object schemas
626
+ * @param params
627
+ */
628
+ static create<Discriminator extends string, Types extends readonly [
629
+ ZodDiscriminatedUnionOption<Discriminator>,
630
+ ...ZodDiscriminatedUnionOption<Discriminator>[]
631
+ ]>(discriminator: Discriminator, options: Types, params?: RawCreateParams): ZodDiscriminatedUnion<Discriminator, Types>;
632
+ }
633
+ export interface ZodIntersectionDef<T extends ZodTypeAny = ZodTypeAny, U extends ZodTypeAny = ZodTypeAny> extends ZodTypeDef {
634
+ left: T;
635
+ right: U;
636
+ typeName: ZodFirstPartyTypeKind.ZodIntersection;
637
+ }
638
+ export declare class ZodIntersection<T extends ZodTypeAny, U extends ZodTypeAny> extends ZodType<T["_output"] & U["_output"], ZodIntersectionDef<T, U>, T["_input"] & U["_input"]> {
639
+ _parse(input: ParseInput): ParseReturnType<this["_output"]>;
640
+ static create: <T_1 extends ZodTypeAny, U_1 extends ZodTypeAny>(left: T_1, right: U_1, params?: RawCreateParams) => ZodIntersection<T_1, U_1>;
641
+ }
642
+ export type ZodTupleItems = [ZodTypeAny, ...ZodTypeAny[]];
643
+ export type AssertArray<T> = T extends any[] ? T : never;
644
+ export type OutputTypeOfTuple<T extends ZodTupleItems | []> = AssertArray<{
645
+ [k in keyof T]: T[k] extends ZodType<any, any, any> ? T[k]["_output"] : never;
646
+ }>;
647
+ export type OutputTypeOfTupleWithRest<T extends ZodTupleItems | [], Rest extends ZodTypeAny | null = null> = Rest extends ZodTypeAny ? [...OutputTypeOfTuple<T>, ...Rest["_output"][]] : OutputTypeOfTuple<T>;
648
+ export type InputTypeOfTuple<T extends ZodTupleItems | []> = AssertArray<{
649
+ [k in keyof T]: T[k] extends ZodType<any, any, any> ? T[k]["_input"] : never;
650
+ }>;
651
+ export type InputTypeOfTupleWithRest<T extends ZodTupleItems | [], Rest extends ZodTypeAny | null = null> = Rest extends ZodTypeAny ? [...InputTypeOfTuple<T>, ...Rest["_input"][]] : InputTypeOfTuple<T>;
652
+ export interface ZodTupleDef<T extends ZodTupleItems | [] = ZodTupleItems, Rest extends ZodTypeAny | null = null> extends ZodTypeDef {
653
+ items: T;
654
+ rest: Rest;
655
+ typeName: ZodFirstPartyTypeKind.ZodTuple;
656
+ }
657
+ export type AnyZodTuple = ZodTuple<[
658
+ ZodTypeAny,
659
+ ...ZodTypeAny[]
660
+ ] | [], ZodTypeAny | null>;
661
+ export declare class ZodTuple<T extends [ZodTypeAny, ...ZodTypeAny[]] | [] = [ZodTypeAny, ...ZodTypeAny[]], Rest extends ZodTypeAny | null = null> extends ZodType<OutputTypeOfTupleWithRest<T, Rest>, ZodTupleDef<T, Rest>, InputTypeOfTupleWithRest<T, Rest>> {
662
+ _parse(input: ParseInput): ParseReturnType<this["_output"]>;
663
+ get items(): T;
664
+ rest<Rest extends ZodTypeAny>(rest: Rest): ZodTuple<T, Rest>;
665
+ static create: <T_1 extends [] | [ZodTypeAny, ...ZodTypeAny[]]>(schemas: T_1, params?: RawCreateParams) => ZodTuple<T_1, null>;
666
+ }
667
+ export interface ZodRecordDef<Key extends KeySchema = ZodString, Value extends ZodTypeAny = ZodTypeAny> extends ZodTypeDef {
668
+ valueType: Value;
669
+ keyType: Key;
670
+ typeName: ZodFirstPartyTypeKind.ZodRecord;
671
+ }
672
+ export type KeySchema = ZodType<string | number | symbol, any, any>;
673
+ export type RecordType<K extends string | number | symbol, V> = [
674
+ string
675
+ ] 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>>;
676
+ export declare class ZodRecord<Key extends KeySchema = ZodString, Value extends ZodTypeAny = ZodTypeAny> extends ZodType<RecordType<Key["_output"], Value["_output"]>, ZodRecordDef<Key, Value>, RecordType<Key["_input"], Value["_input"]>> {
677
+ get keySchema(): Key;
678
+ get valueSchema(): Value;
679
+ _parse(input: ParseInput): ParseReturnType<this["_output"]>;
680
+ get element(): Value;
681
+ static create<Value extends ZodTypeAny>(valueType: Value, params?: RawCreateParams): ZodRecord<ZodString, Value>;
682
+ static create<Keys extends KeySchema, Value extends ZodTypeAny>(keySchema: Keys, valueType: Value, params?: RawCreateParams): ZodRecord<Keys, Value>;
683
+ }
684
+ export interface ZodMapDef<Key extends ZodTypeAny = ZodTypeAny, Value extends ZodTypeAny = ZodTypeAny> extends ZodTypeDef {
685
+ valueType: Value;
686
+ keyType: Key;
687
+ typeName: ZodFirstPartyTypeKind.ZodMap;
688
+ }
689
+ export declare class ZodMap<Key extends ZodTypeAny = ZodTypeAny, Value extends ZodTypeAny = ZodTypeAny> extends ZodType<Map<Key["_output"], Value["_output"]>, ZodMapDef<Key, Value>, Map<Key["_input"], Value["_input"]>> {
690
+ get keySchema(): Key;
691
+ get valueSchema(): Value;
692
+ _parse(input: ParseInput): ParseReturnType<this["_output"]>;
693
+ static create: <Key_1 extends ZodTypeAny = ZodTypeAny, Value_1 extends ZodTypeAny = ZodTypeAny>(keyType: Key_1, valueType: Value_1, params?: RawCreateParams) => ZodMap<Key_1, Value_1>;
694
+ }
695
+ export interface ZodSetDef<Value extends ZodTypeAny = ZodTypeAny> extends ZodTypeDef {
696
+ valueType: Value;
697
+ typeName: ZodFirstPartyTypeKind.ZodSet;
698
+ minSize: {
699
+ value: number;
700
+ message?: string;
701
+ } | null;
702
+ maxSize: {
703
+ value: number;
704
+ message?: string;
705
+ } | null;
706
+ }
707
+ export declare class ZodSet<Value extends ZodTypeAny = ZodTypeAny> extends ZodType<Set<Value["_output"]>, ZodSetDef<Value>, Set<Value["_input"]>> {
708
+ _parse(input: ParseInput): ParseReturnType<this["_output"]>;
709
+ min(minSize: number, message?: errorUtil.ErrMessage): this;
710
+ max(maxSize: number, message?: errorUtil.ErrMessage): this;
711
+ size(size: number, message?: errorUtil.ErrMessage): this;
712
+ nonempty(message?: errorUtil.ErrMessage): ZodSet<Value>;
713
+ static create: <Value_1 extends ZodTypeAny = ZodTypeAny>(valueType: Value_1, params?: RawCreateParams) => ZodSet<Value_1>;
714
+ }
715
+ export interface ZodFunctionDef<Args extends ZodTuple<any, any> = ZodTuple<any, any>, Returns extends ZodTypeAny = ZodTypeAny> extends ZodTypeDef {
716
+ args: Args;
717
+ returns: Returns;
718
+ typeName: ZodFirstPartyTypeKind.ZodFunction;
719
+ }
720
+ export type OuterTypeOfFunction<Args extends ZodTuple<any, any>, Returns extends ZodTypeAny> = Args["_input"] extends Array<any> ? (...args: Args["_input"]) => Returns["_output"] : never;
721
+ export type InnerTypeOfFunction<Args extends ZodTuple<any, any>, Returns extends ZodTypeAny> = Args["_output"] extends Array<any> ? (...args: Args["_output"]) => Returns["_input"] : never;
722
+ export declare class ZodFunction<Args extends ZodTuple<any, any>, Returns extends ZodTypeAny> extends ZodType<OuterTypeOfFunction<Args, Returns>, ZodFunctionDef<Args, Returns>, InnerTypeOfFunction<Args, Returns>> {
723
+ _parse(input: ParseInput): ParseReturnType<any>;
724
+ parameters(): Args;
725
+ returnType(): Returns;
726
+ args<Items extends Parameters<(typeof ZodTuple)["create"]>[0]>(...items: Items): ZodFunction<ZodTuple<Items, ZodUnknown>, Returns>;
727
+ returns<NewReturnType extends ZodType<any, any, any>>(returnType: NewReturnType): ZodFunction<Args, NewReturnType>;
728
+ implement<F extends InnerTypeOfFunction<Args, Returns>>(func: F): ReturnType<F> extends Returns["_output"] ? (...args: Args["_input"]) => ReturnType<F> : OuterTypeOfFunction<Args, Returns>;
729
+ strictImplement(func: InnerTypeOfFunction<Args, Returns>): InnerTypeOfFunction<Args, Returns>;
730
+ validate: <F extends InnerTypeOfFunction<Args, Returns>>(func: F) => ReturnType<F> extends Returns["_output"] ? (...args: Args["_input"]) => ReturnType<F> : OuterTypeOfFunction<Args, Returns>;
731
+ static create(): ZodFunction<ZodTuple<[], ZodUnknown>, ZodUnknown>;
732
+ static create<T extends AnyZodTuple = ZodTuple<[], ZodUnknown>>(args: T): ZodFunction<T, ZodUnknown>;
733
+ static create<T extends AnyZodTuple, U extends ZodTypeAny>(args: T, returns: U): ZodFunction<T, U>;
734
+ static create<T extends AnyZodTuple = ZodTuple<[], ZodUnknown>, U extends ZodTypeAny = ZodUnknown>(args: T, returns: U, params?: RawCreateParams): ZodFunction<T, U>;
735
+ }
736
+ export interface ZodLazyDef<T extends ZodTypeAny = ZodTypeAny> extends ZodTypeDef {
737
+ getter: () => T;
738
+ typeName: ZodFirstPartyTypeKind.ZodLazy;
739
+ }
740
+ export declare class ZodLazy<T extends ZodTypeAny> extends ZodType<output<T>, ZodLazyDef<T>, input<T>> {
741
+ get schema(): T;
742
+ _parse(input: ParseInput): ParseReturnType<this["_output"]>;
743
+ static create: <T_1 extends ZodTypeAny>(getter: () => T_1, params?: RawCreateParams) => ZodLazy<T_1>;
744
+ }
745
+ export interface ZodLiteralDef<T = any> extends ZodTypeDef {
746
+ value: T;
747
+ typeName: ZodFirstPartyTypeKind.ZodLiteral;
748
+ }
749
+ export declare class ZodLiteral<T> extends ZodType<T, ZodLiteralDef<T>, T> {
750
+ _parse(input: ParseInput): ParseReturnType<this["_output"]>;
751
+ get value(): T;
752
+ static create: <T_1 extends Primitive>(value: T_1, params?: RawCreateParams) => ZodLiteral<T_1>;
753
+ }
754
+ export type ArrayKeys = keyof any[];
755
+ export type Indices<T> = Exclude<keyof T, ArrayKeys>;
756
+ export type EnumValues<T extends string = string> = readonly [T, ...T[]];
757
+ export type Values<T extends EnumValues> = {
758
+ [k in T[number]]: k;
759
+ };
760
+ export interface ZodEnumDef<T extends EnumValues = EnumValues> extends ZodTypeDef {
761
+ values: T;
762
+ typeName: ZodFirstPartyTypeKind.ZodEnum;
763
+ }
764
+ export type Writeable<T> = {
765
+ -readonly [P in keyof T]: T[P];
766
+ };
767
+ export type FilterEnum<Values, ToExclude> = Values extends [] ? [] : Values extends [infer Head, ...infer Rest] ? Head extends ToExclude ? FilterEnum<Rest, ToExclude> : [Head, ...FilterEnum<Rest, ToExclude>] : never;
768
+ export type typecast<A, T> = A extends T ? A : never;
769
+ declare function createZodEnum<U extends string, T extends Readonly<[U, ...U[]]>>(values: T, params?: RawCreateParams): ZodEnum<Writeable<T>>;
770
+ declare function createZodEnum<U extends string, T extends [U, ...U[]]>(values: T, params?: RawCreateParams): ZodEnum<T>;
771
+ export declare class ZodEnum<T extends [string, ...string[]]> extends ZodType<T[number], ZodEnumDef<T>, T[number]> {
772
+ #private;
773
+ _parse(input: ParseInput): ParseReturnType<this["_output"]>;
774
+ get options(): T;
775
+ get enum(): Values<T>;
776
+ get Values(): Values<T>;
777
+ get Enum(): Values<T>;
778
+ extract<ToExtract extends readonly [T[number], ...T[number][]]>(values: ToExtract, newDef?: RawCreateParams): ZodEnum<Writeable<ToExtract>>;
779
+ exclude<ToExclude extends readonly [T[number], ...T[number][]]>(values: ToExclude, newDef?: RawCreateParams): ZodEnum<typecast<Writeable<FilterEnum<T, ToExclude[number]>>, [string, ...string[]]>>;
780
+ static create: typeof createZodEnum;
781
+ }
782
+ export interface ZodNativeEnumDef<T extends EnumLike = EnumLike> extends ZodTypeDef {
783
+ values: T;
784
+ typeName: ZodFirstPartyTypeKind.ZodNativeEnum;
785
+ }
786
+ export type EnumLike = {
787
+ [k: string]: string | number;
788
+ [nu: number]: string;
789
+ };
790
+ export declare class ZodNativeEnum<T extends EnumLike> extends ZodType<T[keyof T], ZodNativeEnumDef<T>, T[keyof T]> {
791
+ #private;
792
+ _parse(input: ParseInput): ParseReturnType<T[keyof T]>;
793
+ get enum(): T;
794
+ static create: <T_1 extends EnumLike>(values: T_1, params?: RawCreateParams) => ZodNativeEnum<T_1>;
795
+ }
796
+ export interface ZodPromiseDef<T extends ZodTypeAny = ZodTypeAny> extends ZodTypeDef {
797
+ type: T;
798
+ typeName: ZodFirstPartyTypeKind.ZodPromise;
799
+ }
800
+ export declare class ZodPromise<T extends ZodTypeAny> extends ZodType<Promise<T["_output"]>, ZodPromiseDef<T>, Promise<T["_input"]>> {
801
+ unwrap(): T;
802
+ _parse(input: ParseInput): ParseReturnType<this["_output"]>;
803
+ static create: <T_1 extends ZodTypeAny>(schema: T_1, params?: RawCreateParams) => ZodPromise<T_1>;
804
+ }
805
+ export type Refinement<T> = (arg: T, ctx: RefinementCtx) => any;
806
+ export type SuperRefinement<T> = (arg: T, ctx: RefinementCtx) => void | Promise<void>;
807
+ export type RefinementEffect<T> = {
808
+ type: "refinement";
809
+ refinement: (arg: T, ctx: RefinementCtx) => any;
810
+ };
811
+ export type TransformEffect<T> = {
812
+ type: "transform";
813
+ transform: (arg: T, ctx: RefinementCtx) => any;
814
+ };
815
+ export type PreprocessEffect<T> = {
816
+ type: "preprocess";
817
+ transform: (arg: T, ctx: RefinementCtx) => any;
818
+ };
819
+ export type Effect<T> = RefinementEffect<T> | TransformEffect<T> | PreprocessEffect<T>;
820
+ export interface ZodEffectsDef<T extends ZodTypeAny = ZodTypeAny> extends ZodTypeDef {
821
+ schema: T;
822
+ typeName: ZodFirstPartyTypeKind.ZodEffects;
823
+ effect: Effect<any>;
824
+ }
825
+ export declare class ZodEffects<T extends ZodTypeAny, Output = output<T>, Input = input<T>> extends ZodType<Output, ZodEffectsDef<T>, Input> {
826
+ innerType(): T;
827
+ sourceType(): T;
828
+ _parse(input: ParseInput): ParseReturnType<this["_output"]>;
829
+ static create: <I extends ZodTypeAny>(schema: I, effect: Effect<I["_output"]>, params?: RawCreateParams) => ZodEffects<I, I["_output"]>;
830
+ static createWithPreprocess: <I extends ZodTypeAny>(preprocess: (arg: unknown, ctx: RefinementCtx) => unknown, schema: I, params?: RawCreateParams) => ZodEffects<I, I["_output"], unknown>;
831
+ }
832
+ export { ZodEffects as ZodTransformer };
833
+ export interface ZodOptionalDef<T extends ZodTypeAny = ZodTypeAny> extends ZodTypeDef {
834
+ innerType: T;
835
+ typeName: ZodFirstPartyTypeKind.ZodOptional;
836
+ }
837
+ export type ZodOptionalType<T extends ZodTypeAny> = ZodOptional<T>;
838
+ export declare class ZodOptional<T extends ZodTypeAny> extends ZodType<T["_output"] | undefined, ZodOptionalDef<T>, T["_input"] | undefined> {
839
+ _parse(input: ParseInput): ParseReturnType<this["_output"]>;
840
+ unwrap(): T;
841
+ static create: <T_1 extends ZodTypeAny>(type: T_1, params?: RawCreateParams) => ZodOptional<T_1>;
842
+ }
843
+ export interface ZodNullableDef<T extends ZodTypeAny = ZodTypeAny> extends ZodTypeDef {
844
+ innerType: T;
845
+ typeName: ZodFirstPartyTypeKind.ZodNullable;
846
+ }
847
+ export type ZodNullableType<T extends ZodTypeAny> = ZodNullable<T>;
848
+ export declare class ZodNullable<T extends ZodTypeAny> extends ZodType<T["_output"] | null, ZodNullableDef<T>, T["_input"] | null> {
849
+ _parse(input: ParseInput): ParseReturnType<this["_output"]>;
850
+ unwrap(): T;
851
+ static create: <T_1 extends ZodTypeAny>(type: T_1, params?: RawCreateParams) => ZodNullable<T_1>;
852
+ }
853
+ export interface ZodDefaultDef<T extends ZodTypeAny = ZodTypeAny> extends ZodTypeDef {
854
+ innerType: T;
855
+ defaultValue: () => util.noUndefined<T["_input"]>;
856
+ typeName: ZodFirstPartyTypeKind.ZodDefault;
857
+ }
858
+ export declare class ZodDefault<T extends ZodTypeAny> extends ZodType<util.noUndefined<T["_output"]>, ZodDefaultDef<T>, T["_input"] | undefined> {
859
+ _parse(input: ParseInput): ParseReturnType<this["_output"]>;
860
+ removeDefault(): T;
861
+ static create: <T_1 extends ZodTypeAny>(type: T_1, params: {
862
+ errorMap?: ZodErrorMap | undefined;
863
+ invalid_type_error?: string | undefined;
864
+ required_error?: string | undefined;
865
+ message?: string | undefined;
866
+ description?: string | undefined;
867
+ } & {
868
+ default: T_1["_input"] | (() => util.noUndefined<T_1["_input"]>);
869
+ }) => ZodDefault<T_1>;
870
+ }
871
+ export interface ZodCatchDef<T extends ZodTypeAny = ZodTypeAny> extends ZodTypeDef {
872
+ innerType: T;
873
+ catchValue: (ctx: {
874
+ error: ZodError;
875
+ input: unknown;
876
+ }) => T["_input"];
877
+ typeName: ZodFirstPartyTypeKind.ZodCatch;
878
+ }
879
+ export declare class ZodCatch<T extends ZodTypeAny> extends ZodType<T["_output"], ZodCatchDef<T>, unknown> {
880
+ _parse(input: ParseInput): ParseReturnType<this["_output"]>;
881
+ removeCatch(): T;
882
+ static create: <T_1 extends ZodTypeAny>(type: T_1, params: {
883
+ errorMap?: ZodErrorMap | undefined;
884
+ invalid_type_error?: string | undefined;
885
+ required_error?: string | undefined;
886
+ message?: string | undefined;
887
+ description?: string | undefined;
888
+ } & {
889
+ catch: T_1["_output"] | (() => T_1["_output"]);
890
+ }) => ZodCatch<T_1>;
891
+ }
892
+ export interface ZodNaNDef extends ZodTypeDef {
893
+ typeName: ZodFirstPartyTypeKind.ZodNaN;
894
+ }
895
+ export declare class ZodNaN extends ZodType<number, ZodNaNDef, number> {
896
+ _parse(input: ParseInput): ParseReturnType<any>;
897
+ static create: (params?: RawCreateParams) => ZodNaN;
898
+ }
899
+ export interface ZodBrandedDef<T extends ZodTypeAny> extends ZodTypeDef {
900
+ type: T;
901
+ typeName: ZodFirstPartyTypeKind.ZodBranded;
902
+ }
903
+ export declare const BRAND: unique symbol;
904
+ export type BRAND<T extends string | number | symbol> = {
905
+ [BRAND]: {
906
+ [k in T]: true;
907
+ };
908
+ };
909
+ export declare class ZodBranded<T extends ZodTypeAny, B extends string | number | symbol> extends ZodType<T["_output"] & BRAND<B>, ZodBrandedDef<T>, T["_input"]> {
910
+ _parse(input: ParseInput): ParseReturnType<any>;
911
+ unwrap(): T;
912
+ }
913
+ export interface ZodPipelineDef<A extends ZodTypeAny, B extends ZodTypeAny> extends ZodTypeDef {
914
+ in: A;
915
+ out: B;
916
+ typeName: ZodFirstPartyTypeKind.ZodPipeline;
917
+ }
918
+ export declare class ZodPipeline<A extends ZodTypeAny, B extends ZodTypeAny> extends ZodType<B["_output"], ZodPipelineDef<A, B>, A["_input"]> {
919
+ _parse(input: ParseInput): ParseReturnType<any>;
920
+ static create<A extends ZodTypeAny, B extends ZodTypeAny>(a: A, b: B): ZodPipeline<A, B>;
921
+ }
922
+ type BuiltIn = (((...args: any[]) => any) | (new (...args: any[]) => any)) | {
923
+ readonly [Symbol.toStringTag]: string;
924
+ } | Date | Error | Generator | Promise<unknown> | RegExp;
925
+ 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>;
926
+ export interface ZodReadonlyDef<T extends ZodTypeAny = ZodTypeAny> extends ZodTypeDef {
927
+ innerType: T;
928
+ typeName: ZodFirstPartyTypeKind.ZodReadonly;
929
+ }
930
+ export declare class ZodReadonly<T extends ZodTypeAny> extends ZodType<MakeReadonly<T["_output"]>, ZodReadonlyDef<T>, MakeReadonly<T["_input"]>> {
931
+ _parse(input: ParseInput): ParseReturnType<this["_output"]>;
932
+ static create: <T_1 extends ZodTypeAny>(type: T_1, params?: RawCreateParams) => ZodReadonly<T_1>;
933
+ unwrap(): T;
934
+ }
935
+ type CustomParams = CustomErrorParams & {
936
+ fatal?: boolean;
937
+ };
938
+ export declare function custom<T>(check?: (data: any) => any, _params?: string | CustomParams | ((input: any) => CustomParams),
939
+ /**
940
+ * @deprecated
941
+ *
942
+ * Pass `fatal` into the params object instead:
943
+ *
944
+ * ```ts
945
+ * z.string().custom((val) => val.length > 5, { fatal: false })
946
+ * ```
947
+ *
948
+ */
949
+ fatal?: boolean): ZodType<T, ZodTypeDef, T>;
950
+ export { ZodType as Schema, ZodType as ZodSchema };
951
+ export declare const late: {
952
+ object: <T extends ZodRawShape>(shape: () => T, params?: RawCreateParams) => ZodObject<T, "strip">;
953
+ };
954
+ export declare enum ZodFirstPartyTypeKind {
955
+ ZodString = "ZodString",
956
+ ZodNumber = "ZodNumber",
957
+ ZodNaN = "ZodNaN",
958
+ ZodBigInt = "ZodBigInt",
959
+ ZodBoolean = "ZodBoolean",
960
+ ZodDate = "ZodDate",
961
+ ZodSymbol = "ZodSymbol",
962
+ ZodUndefined = "ZodUndefined",
963
+ ZodNull = "ZodNull",
964
+ ZodAny = "ZodAny",
965
+ ZodUnknown = "ZodUnknown",
966
+ ZodNever = "ZodNever",
967
+ ZodVoid = "ZodVoid",
968
+ ZodArray = "ZodArray",
969
+ ZodObject = "ZodObject",
970
+ ZodUnion = "ZodUnion",
971
+ ZodDiscriminatedUnion = "ZodDiscriminatedUnion",
972
+ ZodIntersection = "ZodIntersection",
973
+ ZodTuple = "ZodTuple",
974
+ ZodRecord = "ZodRecord",
975
+ ZodMap = "ZodMap",
976
+ ZodSet = "ZodSet",
977
+ ZodFunction = "ZodFunction",
978
+ ZodLazy = "ZodLazy",
979
+ ZodLiteral = "ZodLiteral",
980
+ ZodEnum = "ZodEnum",
981
+ ZodEffects = "ZodEffects",
982
+ ZodNativeEnum = "ZodNativeEnum",
983
+ ZodOptional = "ZodOptional",
984
+ ZodNullable = "ZodNullable",
985
+ ZodDefault = "ZodDefault",
986
+ ZodCatch = "ZodCatch",
987
+ ZodPromise = "ZodPromise",
988
+ ZodBranded = "ZodBranded",
989
+ ZodPipeline = "ZodPipeline",
990
+ ZodReadonly = "ZodReadonly"
991
+ }
992
+ 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;
993
+ declare abstract class Class {
994
+ constructor(..._: any[]);
995
+ }
996
+ declare const instanceOfType: <T extends typeof Class>(cls: T, params?: CustomParams) => ZodType<InstanceType<T>, ZodTypeDef, InstanceType<T>>;
997
+ declare const stringType: (params?: RawCreateParams & {
998
+ coerce?: true;
999
+ }) => ZodString;
1000
+ declare const numberType: (params?: RawCreateParams & {
1001
+ coerce?: boolean;
1002
+ }) => ZodNumber;
1003
+ declare const nanType: (params?: RawCreateParams) => ZodNaN;
1004
+ declare const bigIntType: (params?: RawCreateParams & {
1005
+ coerce?: boolean;
1006
+ }) => ZodBigInt;
1007
+ declare const booleanType: (params?: RawCreateParams & {
1008
+ coerce?: boolean;
1009
+ }) => ZodBoolean;
1010
+ declare const dateType: (params?: RawCreateParams & {
1011
+ coerce?: boolean;
1012
+ }) => ZodDate;
1013
+ declare const symbolType: (params?: RawCreateParams) => ZodSymbol;
1014
+ declare const undefinedType: (params?: RawCreateParams) => ZodUndefined;
1015
+ declare const nullType: (params?: RawCreateParams) => ZodNull;
1016
+ declare const anyType: (params?: RawCreateParams) => ZodAny;
1017
+ declare const unknownType: (params?: RawCreateParams) => ZodUnknown;
1018
+ declare const neverType: (params?: RawCreateParams) => ZodNever;
1019
+ declare const voidType: (params?: RawCreateParams) => ZodVoid;
1020
+ declare const arrayType: <T extends ZodTypeAny>(schema: T, params?: RawCreateParams) => ZodArray<T>;
1021
+ declare const objectType: <T extends ZodRawShape>(shape: T, params?: RawCreateParams) => ZodObject<T, "strip", ZodTypeAny, objectOutputType<T, ZodTypeAny, "strip">, objectInputType<T, ZodTypeAny, "strip">>;
1022
+ declare const strictObjectType: <T extends ZodRawShape>(shape: T, params?: RawCreateParams) => ZodObject<T, "strict">;
1023
+ declare const unionType: <T extends readonly [ZodTypeAny, ZodTypeAny, ...ZodTypeAny[]]>(types: T, params?: RawCreateParams) => ZodUnion<T>;
1024
+ declare const discriminatedUnionType: typeof ZodDiscriminatedUnion.create;
1025
+ declare const intersectionType: <T extends ZodTypeAny, U extends ZodTypeAny>(left: T, right: U, params?: RawCreateParams) => ZodIntersection<T, U>;
1026
+ declare const tupleType: <T extends [] | [ZodTypeAny, ...ZodTypeAny[]]>(schemas: T, params?: RawCreateParams) => ZodTuple<T, null>;
1027
+ declare const recordType: typeof ZodRecord.create;
1028
+ declare const mapType: <Key extends ZodTypeAny = ZodTypeAny, Value extends ZodTypeAny = ZodTypeAny>(keyType: Key, valueType: Value, params?: RawCreateParams) => ZodMap<Key, Value>;
1029
+ declare const setType: <Value extends ZodTypeAny = ZodTypeAny>(valueType: Value, params?: RawCreateParams) => ZodSet<Value>;
1030
+ declare const functionType: typeof ZodFunction.create;
1031
+ declare const lazyType: <T extends ZodTypeAny>(getter: () => T, params?: RawCreateParams) => ZodLazy<T>;
1032
+ declare const literalType: <T extends Primitive>(value: T, params?: RawCreateParams) => ZodLiteral<T>;
1033
+ declare const enumType: typeof createZodEnum;
1034
+ declare const nativeEnumType: <T extends EnumLike>(values: T, params?: RawCreateParams) => ZodNativeEnum<T>;
1035
+ declare const promiseType: <T extends ZodTypeAny>(schema: T, params?: RawCreateParams) => ZodPromise<T>;
1036
+ declare const effectsType: <I extends ZodTypeAny>(schema: I, effect: Effect<I["_output"]>, params?: RawCreateParams) => ZodEffects<I, I["_output"]>;
1037
+ declare const optionalType: <T extends ZodTypeAny>(type: T, params?: RawCreateParams) => ZodOptional<T>;
1038
+ declare const nullableType: <T extends ZodTypeAny>(type: T, params?: RawCreateParams) => ZodNullable<T>;
1039
+ declare const preprocessType: <I extends ZodTypeAny>(preprocess: (arg: unknown, ctx: RefinementCtx) => unknown, schema: I, params?: RawCreateParams) => ZodEffects<I, I["_output"], unknown>;
1040
+ declare const pipelineType: typeof ZodPipeline.create;
1041
+ declare const ostring: () => ZodOptional<ZodString>;
1042
+ declare const onumber: () => ZodOptional<ZodNumber>;
1043
+ declare const oboolean: () => ZodOptional<ZodBoolean>;
1044
+ export declare const coerce: {
1045
+ string: (params?: RawCreateParams & {
1046
+ coerce?: true;
1047
+ }) => ZodString;
1048
+ number: (params?: RawCreateParams & {
1049
+ coerce?: boolean;
1050
+ }) => ZodNumber;
1051
+ boolean: (params?: RawCreateParams & {
1052
+ coerce?: boolean;
1053
+ }) => ZodBoolean;
1054
+ bigint: (params?: RawCreateParams & {
1055
+ coerce?: boolean;
1056
+ }) => ZodBigInt;
1057
+ date: (params?: RawCreateParams & {
1058
+ coerce?: boolean;
1059
+ }) => ZodDate;
1060
+ };
1061
+ 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, };
1062
+ export declare const NEVER: never;