@rspack/core 1.3.12 → 1.3.14
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.
- package/README.md +2 -2
- package/compiled/browserslist-load-config/index.d.ts +10 -0
- package/compiled/browserslist-load-config/index.js +266 -0
- package/compiled/browserslist-load-config/license +21 -0
- package/compiled/browserslist-load-config/package.json +1 -0
- package/compiled/watchpack/index.js +18 -14
- package/compiled/watchpack/package.json +1 -1
- package/compiled/zod/dist/types/v3/types.d.ts +2 -2
- package/compiled/zod/dist/types/v4/classic/coerce.d.ts +5 -5
- package/compiled/zod/dist/types/v4/classic/external.d.ts +6 -1
- package/compiled/zod/dist/types/v4/classic/schemas.d.ts +95 -133
- package/compiled/zod/dist/types/v4/core/api.d.ts +2 -2
- package/compiled/zod/dist/types/v4/core/core.d.ts +11 -7
- package/compiled/zod/dist/types/v4/core/errors.d.ts +0 -1
- package/compiled/zod/dist/types/v4/core/function.d.ts +16 -11
- package/compiled/zod/dist/types/v4/core/regexes.d.ts +1 -1
- package/compiled/zod/dist/types/v4/core/registries.d.ts +6 -1
- package/compiled/zod/dist/types/v4/core/schemas.d.ts +145 -117
- package/compiled/zod/dist/types/v4/core/util.d.ts +5 -9
- package/compiled/zod/dist/types/v4/locales/ar.d.ts +0 -3
- package/compiled/zod/dist/types/v4/locales/az.d.ts +0 -3
- package/compiled/zod/dist/types/v4/locales/be.d.ts +0 -3
- package/compiled/zod/dist/types/v4/locales/ca.d.ts +0 -3
- package/compiled/zod/dist/types/v4/locales/cs.d.ts +0 -3
- package/compiled/zod/dist/types/v4/locales/de.d.ts +0 -3
- package/compiled/zod/dist/types/v4/locales/en.d.ts +0 -2
- package/compiled/zod/dist/types/v4/locales/es.d.ts +0 -3
- package/compiled/zod/dist/types/v4/locales/fa.d.ts +0 -3
- package/compiled/zod/dist/types/v4/locales/fi.d.ts +0 -3
- package/compiled/zod/dist/types/v4/locales/{frCA.d.ts → fr-CA.d.ts} +0 -3
- package/compiled/zod/dist/types/v4/locales/fr.d.ts +0 -3
- package/compiled/zod/dist/types/v4/locales/he.d.ts +0 -3
- package/compiled/zod/dist/types/v4/locales/hu.d.ts +0 -3
- package/compiled/zod/dist/types/v4/locales/id.d.ts +0 -3
- package/compiled/zod/dist/types/v4/locales/index.d.ts +5 -2
- package/compiled/zod/dist/types/v4/locales/it.d.ts +0 -3
- package/compiled/zod/dist/types/v4/locales/ja.d.ts +0 -3
- package/compiled/zod/dist/types/v4/locales/{zh-tw.d.ts → kh.d.ts} +0 -3
- package/compiled/zod/dist/types/v4/locales/ko.d.ts +0 -3
- package/compiled/zod/dist/types/v4/locales/mk.d.ts +0 -3
- package/compiled/zod/dist/types/v4/locales/ms.d.ts +0 -3
- package/compiled/zod/dist/types/v4/locales/nl.d.ts +4 -0
- package/compiled/zod/dist/types/v4/locales/no.d.ts +0 -3
- package/compiled/zod/dist/types/v4/locales/ota.d.ts +0 -3
- package/compiled/zod/dist/types/v4/locales/pl.d.ts +0 -3
- package/compiled/zod/dist/types/v4/locales/pt.d.ts +0 -3
- package/compiled/zod/dist/types/v4/locales/ru.d.ts +0 -3
- package/compiled/zod/dist/types/v4/locales/sl.d.ts +0 -3
- package/compiled/zod/dist/types/v4/locales/sv.d.ts +4 -0
- package/compiled/zod/dist/types/v4/locales/ta.d.ts +0 -3
- package/compiled/zod/dist/types/v4/locales/th.d.ts +0 -3
- package/compiled/zod/dist/types/v4/locales/tr.d.ts +0 -2
- package/compiled/zod/dist/types/v4/locales/ua.d.ts +0 -3
- package/compiled/zod/dist/types/v4/locales/ur.d.ts +0 -3
- package/compiled/zod/dist/types/v4/locales/vi.d.ts +0 -3
- package/compiled/zod/dist/types/v4/locales/zh-CN.d.ts +0 -3
- package/compiled/zod/dist/types/v4/locales/zh-TW.d.ts +4 -0
- package/compiled/zod/dist/types/v4/mini/external.d.ts +5 -1
- package/compiled/zod/dist/types/v4/mini/schemas.d.ts +40 -49
- package/compiled/zod/index.js +42 -64
- package/compiled/zod/package.json +1 -1
- package/compiled/zod/v3/index.d.ts +3 -1
- package/compiled/zod/v4/core/index.d.ts +1 -1
- package/compiled/zod/v4/index.d.ts +3 -1
- package/compiled/zod/v4/locales/index.d.ts +1 -1
- package/compiled/zod/v4-mini/index.d.ts +1 -1
- package/dist/ErrorHelpers.d.ts +0 -15
- package/dist/Module.d.ts +5 -1
- package/dist/ModuleTypeConstants.d.ts +0 -85
- package/dist/RspackError.d.ts +0 -3
- package/dist/builtin-loader/lightningcss/index.d.ts +23 -1
- package/dist/builtin-loader/swc/types.d.ts +289 -2426
- package/dist/builtin-plugin/APIPlugin.d.ts +1 -1
- package/dist/builtin-plugin/ArrayPushCallbackChunkFormatPlugin.d.ts +1 -1
- package/dist/builtin-plugin/AssetModulesPlugin.d.ts +1 -1
- package/dist/builtin-plugin/AsyncWebAssemblyModulesPlugin.d.ts +1 -1
- package/dist/builtin-plugin/BannerPlugin.d.ts +1 -1
- package/dist/builtin-plugin/BundlerInfoRspackPlugin.d.ts +1 -1
- package/dist/builtin-plugin/ChunkPrefetchPreloadPlugin.d.ts +1 -1
- package/dist/builtin-plugin/CommonJsChunkFormatPlugin.d.ts +1 -1
- package/dist/builtin-plugin/ContextReplacementPlugin.d.ts +1 -1
- package/dist/builtin-plugin/CopyRspackPlugin.d.ts +1 -1
- package/dist/builtin-plugin/CssChunkingPlugin.d.ts +1 -1
- package/dist/builtin-plugin/CssModulesPlugin.d.ts +1 -1
- package/dist/builtin-plugin/DataUriPlugin.d.ts +1 -1
- package/dist/builtin-plugin/DefinePlugin.d.ts +1 -1
- package/dist/builtin-plugin/DllEntryPlugin.d.ts +1 -1
- package/dist/builtin-plugin/DllReferenceAgencyPlugin.d.ts +1 -1
- package/dist/builtin-plugin/ElectronTargetPlugin.d.ts +1 -1
- package/dist/builtin-plugin/EnableChunkLoadingPlugin.d.ts +1 -1
- package/dist/builtin-plugin/EnableWasmLoadingPlugin.d.ts +1 -1
- package/dist/builtin-plugin/EnsureChunkConditionsPlugin.d.ts +1 -1
- package/dist/builtin-plugin/EntryPlugin.d.ts +1 -1
- package/dist/builtin-plugin/EvalDevToolModulePlugin.d.ts +1 -1
- package/dist/builtin-plugin/EvalSourceMapDevToolPlugin.d.ts +1 -1
- package/dist/builtin-plugin/FetchCompileAsyncWasmPlugin.d.ts +1 -1
- package/dist/builtin-plugin/FileUriPlugin.d.ts +1 -1
- package/dist/builtin-plugin/FlagAllModulesAsUsedPlugin.d.ts +1 -1
- package/dist/builtin-plugin/FlagDependencyExportsPlugin.d.ts +1 -1
- package/dist/builtin-plugin/HttpExternalsRspackPlugin.d.ts +1 -1
- package/dist/builtin-plugin/IgnorePlugin.d.ts +1 -1
- package/dist/builtin-plugin/InferAsyncModulesPlugin.d.ts +1 -1
- package/dist/builtin-plugin/JsLoaderRspackPlugin.d.ts +1 -1
- package/dist/builtin-plugin/JsonModulesPlugin.d.ts +1 -1
- package/dist/builtin-plugin/LibManifestPlugin.d.ts +1 -1
- package/dist/builtin-plugin/LightningCssMinimizerRspackPlugin.d.ts +1 -1
- package/dist/builtin-plugin/LimitChunkCountPlugin.d.ts +1 -1
- package/dist/builtin-plugin/MergeDuplicateChunksPlugin.d.ts +1 -1
- package/dist/builtin-plugin/ModuleChunkFormatPlugin.d.ts +1 -1
- package/dist/builtin-plugin/ModuleInfoHeaderPlugin.d.ts +1 -1
- package/dist/builtin-plugin/NamedChunkIdsPlugin.d.ts +1 -1
- package/dist/builtin-plugin/NamedModuleIdsPlugin.d.ts +1 -1
- package/dist/builtin-plugin/NoEmitOnErrorsPlugin.d.ts +1 -1
- package/dist/builtin-plugin/NodeTargetPlugin.d.ts +1 -1
- package/dist/builtin-plugin/OccurrenceChunkIdsPlugin.d.ts +1 -1
- package/dist/builtin-plugin/ProgressPlugin.d.ts +1 -1
- package/dist/builtin-plugin/ProvidePlugin.d.ts +1 -1
- package/dist/builtin-plugin/RealContentHashPlugin.d.ts +1 -1
- package/dist/builtin-plugin/RemoveDuplicateModulesPlugin.d.ts +1 -1
- package/dist/builtin-plugin/RemoveEmptyChunksPlugin.d.ts +1 -1
- package/dist/builtin-plugin/RsdoctorPlugin.d.ts +1 -1
- package/dist/builtin-plugin/RstestPlugin.d.ts +1 -1
- package/dist/builtin-plugin/RuntimeChunkPlugin.d.ts +1 -1
- package/dist/builtin-plugin/RuntimePlugin.d.ts +1 -1
- package/dist/builtin-plugin/SideEffectsFlagPlugin.d.ts +1 -1
- package/dist/builtin-plugin/SizeLimitsPlugin.d.ts +1 -1
- package/dist/builtin-plugin/SourceMapDevToolPlugin.d.ts +1 -1
- package/dist/builtin-plugin/SubresourceIntegrityPlugin.d.ts +1 -1
- package/dist/builtin-plugin/SwcJsMinimizerPlugin.d.ts +1 -1
- package/dist/builtin-plugin/WarnCaseSensitiveModulesPlugin.d.ts +1 -1
- package/dist/builtin-plugin/base.d.ts +1 -2
- package/dist/builtin-plugin/html-plugin/plugin.d.ts +1 -1
- package/dist/builtin-plugin/lazy-compilation/lazyCompilation.d.ts +1 -1
- package/dist/config/browserslistTargetHandler.d.ts +0 -6
- package/dist/config/zod.d.ts +370 -370
- package/dist/container/ModuleFederationRuntimePlugin.d.ts +1 -1
- package/dist/exports.d.ts +1 -0
- package/dist/index.js +67 -71
- package/dist/lib/AbstractMethodError.d.ts +0 -1
- package/dist/lib/CacheFacade.d.ts +0 -28
- package/dist/loader-runner/index.d.ts +1 -0
- package/dist/stats/statsFactoryUtils.d.ts +24 -4
- package/dist/util/cleverMerge.d.ts +0 -30
- package/dist/util/comparators.d.ts +0 -4
- package/dist/util/hash/wasm-hash.d.ts +0 -1
- package/dist/util/identifier.d.ts +0 -12
- package/dist/util/index.d.ts +1 -7
- package/dist/util/memoize.d.ts +0 -1
- package/dist/worker.js +5 -7
- package/module.d.ts +53 -21
- package/package.json +11 -12
- package/compiled/browserslist/index.d.ts +0 -1
- package/compiled/browserslist/index.js +0 -2123
- package/compiled/browserslist/license +0 -20
- package/compiled/browserslist/package.json +0 -1
- package/dist/util/hash/BatchedHash.d.ts +0 -25
@@ -1,19 +1,20 @@
|
|
1
1
|
import * as core from "zod/v4/core";
|
2
2
|
import { util } from "zod/v4/core";
|
3
3
|
import * as parse from "./parse.js";
|
4
|
-
export * as iso from "./iso.js";
|
5
|
-
export * as coerce from "./coerce.js";
|
6
4
|
export interface RefinementCtx<T = unknown> extends core.ParsePayload<T> {
|
7
5
|
addIssue(arg: string | core.$ZodRawIssue | Partial<core.$ZodIssueCustom>): void;
|
8
6
|
}
|
9
|
-
export interface ZodType<out Output = unknown, out Input = unknown> extends core.$ZodType<Output, Input> {
|
10
|
-
def:
|
7
|
+
export interface ZodType<out Output = unknown, out Input = unknown, out Internals extends core.$ZodTypeInternals<Output, Input> = core.$ZodTypeInternals<Output, Input>> extends core.$ZodType<Output, Input, Internals> {
|
8
|
+
def: Internals["def"];
|
9
|
+
type: Internals["def"]["type"];
|
11
10
|
/** @deprecated Use `.def` instead. */
|
12
|
-
_def:
|
13
|
-
|
14
|
-
|
11
|
+
_def: Internals["def"];
|
12
|
+
/** @deprecated Use `z.output<typeof schema>` instead. */
|
13
|
+
_output: Internals["output"];
|
14
|
+
/** @deprecated Use `z.input<typeof schema>` instead. */
|
15
|
+
_input: Internals["input"];
|
15
16
|
check(...checks: (core.CheckFn<core.output<this>> | core.$ZodCheck<core.output<this>>)[]): this;
|
16
|
-
clone(def?:
|
17
|
+
clone(def?: Internals["def"], params?: {
|
17
18
|
parent: boolean;
|
18
19
|
}): this;
|
19
20
|
register<R extends core.$ZodRegistry>(registry: R, ...meta: this extends R["_schema"] ? undefined extends R["_meta"] ? [core.$replace<R["_meta"], this>?] : [core.$replace<R["_meta"], this>] : ["Incompatible schema"]): this;
|
@@ -25,7 +26,7 @@ export interface ZodType<out Output = unknown, out Input = unknown> extends core
|
|
25
26
|
spa: (data: unknown, params?: core.ParseContext<core.$ZodIssue>) => Promise<parse.ZodSafeParseResult<core.output<this>>>;
|
26
27
|
refine(check: (arg: core.output<this>) => unknown | Promise<unknown>, params?: string | core.$ZodCustomParams): this;
|
27
28
|
/** @deprecated Use `.check()` instead. */
|
28
|
-
superRefine(refinement: (arg: core.output<this>, ctx: RefinementCtx<this
|
29
|
+
superRefine(refinement: (arg: core.output<this>, ctx: RefinementCtx<core.output<this>>) => void | Promise<void>): this;
|
29
30
|
overwrite(fn: (x: core.output<this>) => core.output<this>): this;
|
30
31
|
optional(): ZodOptional<this>;
|
31
32
|
nonoptional(params?: string | core.$ZodNonOptionalParams): ZodNonOptional<this>;
|
@@ -36,12 +37,12 @@ export interface ZodType<out Output = unknown, out Input = unknown> extends core
|
|
36
37
|
prefault(def: () => core.input<this>): ZodPrefault<this>;
|
37
38
|
prefault(def: core.input<this>): ZodPrefault<this>;
|
38
39
|
array(): ZodArray<this>;
|
39
|
-
or<T extends core
|
40
|
-
and<T extends core
|
40
|
+
or<T extends core.SomeType>(option: T): ZodUnion<[this, T]>;
|
41
|
+
and<T extends core.SomeType>(incoming: T): ZodIntersection<this, T>;
|
41
42
|
transform<NewOut>(transform: (arg: core.output<this>, ctx: RefinementCtx<core.output<this>>) => NewOut | Promise<NewOut>): ZodPipe<this, ZodTransform<Awaited<NewOut>, core.output<this>>>;
|
42
43
|
catch(def: core.output<this>): ZodCatch<this>;
|
43
44
|
catch(def: (ctx: core.$ZodCatchCtx) => core.output<this>): ZodCatch<this>;
|
44
|
-
pipe<T extends core.$ZodType<any, this
|
45
|
+
pipe<T extends core.$ZodType<any, core.output<this>>>(target: T | core.$ZodType<any, core.output<this>>): ZodPipe<this, T>;
|
45
46
|
readonly(): ZodReadonly<this>;
|
46
47
|
/** Returns a new instance that has been registered in `z.globalRegistry` with the specified description */
|
47
48
|
describe(description: string): this;
|
@@ -68,9 +69,10 @@ export interface ZodType<out Output = unknown, out Input = unknown> extends core
|
|
68
69
|
*/
|
69
70
|
isNullable(): boolean;
|
70
71
|
}
|
72
|
+
export interface _ZodType<out Internals extends core.$ZodTypeInternals = core.$ZodTypeInternals> extends ZodType<any, any, Internals> {
|
73
|
+
}
|
71
74
|
export declare const ZodType: core.$constructor<ZodType>;
|
72
|
-
export interface _ZodString<
|
73
|
-
_zod: core.$ZodStringInternals<Input>;
|
75
|
+
export interface _ZodString<T extends core.$ZodStringInternals<unknown> = core.$ZodStringInternals<unknown>> extends _ZodType<T> {
|
74
76
|
format: string | null;
|
75
77
|
minLength: number | null;
|
76
78
|
maxLength: number | null;
|
@@ -91,7 +93,7 @@ export interface _ZodString<Input = unknown> extends ZodType {
|
|
91
93
|
}
|
92
94
|
/** @internal */
|
93
95
|
export declare const _ZodString: core.$constructor<_ZodString>;
|
94
|
-
export interface ZodString extends _ZodString<string
|
96
|
+
export interface ZodString extends _ZodString<core.$ZodStringInternals<string>> {
|
95
97
|
/** @deprecated Use `z.email()` instead. */
|
96
98
|
email(params?: string | core.$ZodCheckEmailParams): this;
|
97
99
|
/** @deprecated Use `z.url()` instead. */
|
@@ -149,8 +151,7 @@ export interface ZodString extends _ZodString<string> {
|
|
149
151
|
}
|
150
152
|
export declare const ZodString: core.$constructor<ZodString>;
|
151
153
|
export declare function string(params?: string | core.$ZodStringParams): ZodString;
|
152
|
-
export interface ZodStringFormat<Format extends core.$ZodStringFormats = core.$ZodStringFormats> extends _ZodString {
|
153
|
-
_zod: core.$ZodStringFormatInternals<Format>;
|
154
|
+
export interface ZodStringFormat<Format extends core.$ZodStringFormats = core.$ZodStringFormats> extends _ZodString<core.$ZodStringFormatInternals<Format>> {
|
154
155
|
}
|
155
156
|
export declare const ZodStringFormat: core.$constructor<ZodStringFormat>;
|
156
157
|
export interface ZodEmail extends ZodStringFormat<"email"> {
|
@@ -251,8 +252,7 @@ export interface ZodJWT extends ZodStringFormat<"jwt"> {
|
|
251
252
|
}
|
252
253
|
export declare const ZodJWT: core.$constructor<ZodJWT>;
|
253
254
|
export declare function jwt(params?: string | core.$ZodJWTParams): ZodJWT;
|
254
|
-
export interface _ZodNumber<
|
255
|
-
_zod: core.$ZodNumberInternals<Input>;
|
255
|
+
export interface _ZodNumber<Internals extends core.$ZodNumberInternals = core.$ZodNumberInternals> extends _ZodType<Internals> {
|
256
256
|
gt(value: number, params?: string | core.$ZodCheckGreaterThanParams): this;
|
257
257
|
/** Identical to .min() */
|
258
258
|
gte(value: number, params?: string | core.$ZodCheckGreaterThanParams): this;
|
@@ -282,7 +282,7 @@ export interface _ZodNumber<Input = unknown> extends ZodType {
|
|
282
282
|
isFinite: boolean;
|
283
283
|
format: string | null;
|
284
284
|
}
|
285
|
-
export interface ZodNumber extends _ZodNumber<number
|
285
|
+
export interface ZodNumber extends _ZodNumber<core.$ZodNumberInternals<number>> {
|
286
286
|
}
|
287
287
|
export declare const ZodNumber: core.$constructor<ZodNumber>;
|
288
288
|
export declare function number(params?: string | core.$ZodNumberParams): ZodNumber;
|
@@ -305,15 +305,13 @@ export declare function int32(params?: string | core.$ZodCheckNumberFormatParams
|
|
305
305
|
export interface ZodUInt32 extends ZodNumberFormat {
|
306
306
|
}
|
307
307
|
export declare function uint32(params?: string | core.$ZodCheckNumberFormatParams): ZodUInt32;
|
308
|
-
export interface _ZodBoolean<T =
|
309
|
-
_zod: core.$ZodBooleanInternals<T>;
|
308
|
+
export interface _ZodBoolean<T extends core.$ZodBooleanInternals = core.$ZodBooleanInternals> extends _ZodType<T> {
|
310
309
|
}
|
311
|
-
export interface ZodBoolean extends _ZodBoolean<boolean
|
310
|
+
export interface ZodBoolean extends _ZodBoolean<core.$ZodBooleanInternals<boolean>> {
|
312
311
|
}
|
313
312
|
export declare const ZodBoolean: core.$constructor<ZodBoolean>;
|
314
313
|
export declare function boolean(params?: string | core.$ZodBooleanParams): ZodBoolean;
|
315
|
-
export interface _ZodBigInt<T =
|
316
|
-
_zod: core.$ZodBigIntInternals<T>;
|
314
|
+
export interface _ZodBigInt<T extends core.$ZodBigIntInternals = core.$ZodBigIntInternals> extends _ZodType<T> {
|
317
315
|
gte(value: bigint, params?: string | core.$ZodCheckGreaterThanParams): this;
|
318
316
|
/** Alias of `.gte()` */
|
319
317
|
min(value: bigint, params?: string | core.$ZodCheckGreaterThanParams): this;
|
@@ -331,7 +329,7 @@ export interface _ZodBigInt<T = unknown> extends ZodType {
|
|
331
329
|
maxValue: bigint | null;
|
332
330
|
format: string | null;
|
333
331
|
}
|
334
|
-
export interface ZodBigInt extends _ZodBigInt<bigint
|
332
|
+
export interface ZodBigInt extends _ZodBigInt<core.$ZodBigIntInternals<bigint>> {
|
335
333
|
}
|
336
334
|
export declare const ZodBigInt: core.$constructor<ZodBigInt>;
|
337
335
|
export declare function bigint(params?: string | core.$ZodBigIntParams): ZodBigInt;
|
@@ -341,46 +339,38 @@ export interface ZodBigIntFormat extends ZodBigInt {
|
|
341
339
|
export declare const ZodBigIntFormat: core.$constructor<ZodBigIntFormat>;
|
342
340
|
export declare function int64(params?: string | core.$ZodBigIntFormatParams): ZodBigIntFormat;
|
343
341
|
export declare function uint64(params?: string | core.$ZodBigIntFormatParams): ZodBigIntFormat;
|
344
|
-
export interface ZodSymbol extends
|
345
|
-
_zod: core.$ZodSymbolInternals;
|
342
|
+
export interface ZodSymbol extends _ZodType<core.$ZodSymbolInternals> {
|
346
343
|
}
|
347
344
|
export declare const ZodSymbol: core.$constructor<ZodSymbol>;
|
348
345
|
export declare function symbol(params?: string | core.$ZodSymbolParams): ZodSymbol;
|
349
|
-
export interface ZodUndefined extends
|
350
|
-
_zod: core.$ZodUndefinedInternals;
|
346
|
+
export interface ZodUndefined extends _ZodType<core.$ZodUndefinedInternals> {
|
351
347
|
}
|
352
348
|
export declare const ZodUndefined: core.$constructor<ZodUndefined>;
|
353
349
|
declare function _undefined(params?: string | core.$ZodUndefinedParams): ZodUndefined;
|
354
350
|
export { _undefined as undefined };
|
355
|
-
export interface ZodNull extends
|
356
|
-
_zod: core.$ZodNullInternals;
|
351
|
+
export interface ZodNull extends _ZodType<core.$ZodNullInternals> {
|
357
352
|
}
|
358
353
|
export declare const ZodNull: core.$constructor<ZodNull>;
|
359
354
|
declare function _null(params?: string | core.$ZodNullParams): ZodNull;
|
360
355
|
export { _null as null };
|
361
|
-
export interface ZodAny extends
|
362
|
-
_zod: core.$ZodAnyInternals;
|
356
|
+
export interface ZodAny extends _ZodType<core.$ZodAnyInternals> {
|
363
357
|
}
|
364
358
|
export declare const ZodAny: core.$constructor<ZodAny>;
|
365
359
|
export declare function any(): ZodAny;
|
366
|
-
export interface ZodUnknown extends
|
367
|
-
_zod: core.$ZodUnknownInternals;
|
360
|
+
export interface ZodUnknown extends _ZodType<core.$ZodUnknownInternals> {
|
368
361
|
}
|
369
362
|
export declare const ZodUnknown: core.$constructor<ZodUnknown>;
|
370
363
|
export declare function unknown(): ZodUnknown;
|
371
|
-
export interface ZodNever extends
|
372
|
-
_zod: core.$ZodNeverInternals;
|
364
|
+
export interface ZodNever extends _ZodType<core.$ZodNeverInternals> {
|
373
365
|
}
|
374
366
|
export declare const ZodNever: core.$constructor<ZodNever>;
|
375
367
|
export declare function never(params?: string | core.$ZodNeverParams): ZodNever;
|
376
|
-
export interface ZodVoid extends
|
377
|
-
_zod: core.$ZodVoidInternals;
|
368
|
+
export interface ZodVoid extends _ZodType<core.$ZodVoidInternals> {
|
378
369
|
}
|
379
370
|
export declare const ZodVoid: core.$constructor<ZodVoid>;
|
380
371
|
declare function _void(params?: string | core.$ZodVoidParams): ZodVoid;
|
381
372
|
export { _void as void };
|
382
|
-
export interface _ZodDate<T =
|
383
|
-
_zod: core.$ZodDateInternals<T>;
|
373
|
+
export interface _ZodDate<T extends core.$ZodDateInternals = core.$ZodDateInternals> extends _ZodType<T> {
|
384
374
|
min(value: number | Date, params?: string | core.$ZodCheckGreaterThanParams): this;
|
385
375
|
max(value: number | Date, params?: string | core.$ZodCheckLessThanParams): this;
|
386
376
|
/** @deprecated Not recommended. */
|
@@ -388,29 +378,28 @@ export interface _ZodDate<T = unknown> extends ZodType {
|
|
388
378
|
/** @deprecated Not recommended. */
|
389
379
|
maxDate: Date | null;
|
390
380
|
}
|
391
|
-
export interface ZodDate extends _ZodDate<Date
|
381
|
+
export interface ZodDate extends _ZodDate<core.$ZodDateInternals<Date>> {
|
392
382
|
}
|
393
383
|
export declare const ZodDate: core.$constructor<ZodDate>;
|
394
384
|
export declare function date(params?: string | core.$ZodDateParams): ZodDate;
|
395
|
-
export interface ZodArray<T extends core
|
396
|
-
_zod: core.$ZodArrayInternals<T>;
|
385
|
+
export interface ZodArray<T extends core.SomeType = core.$ZodType> extends ZodType<any, any, core.$ZodArrayInternals<T>>, core.$ZodArray<T> {
|
397
386
|
element: T;
|
398
387
|
min(minLength: number, params?: string | core.$ZodCheckMinLengthParams): this;
|
399
388
|
nonempty(params?: string | core.$ZodCheckMinLengthParams): this;
|
400
389
|
max(maxLength: number, params?: string | core.$ZodCheckMaxLengthParams): this;
|
401
390
|
length(len: number, params?: string | core.$ZodCheckLengthEqualsParams): this;
|
391
|
+
unwrap(): T;
|
402
392
|
}
|
403
393
|
export declare const ZodArray: core.$constructor<ZodArray>;
|
404
|
-
export declare function array<T extends core
|
394
|
+
export declare function array<T extends core.SomeType>(element: T, params?: string | core.$ZodArrayParams): ZodArray<T>;
|
405
395
|
export declare function keyof<T extends ZodObject>(schema: T): ZodLiteral<keyof T["_zod"]["output"]>;
|
406
396
|
export interface ZodObject<
|
407
397
|
/** @ts-ignore Cast variance */
|
408
|
-
out Shape extends core.$ZodShape = core.$ZodLooseShape, out Config extends core.$ZodObjectConfig = core.$ZodObjectConfig> extends
|
409
|
-
_zod: core.$ZodObjectInternals<Shape, Config>;
|
398
|
+
out Shape extends core.$ZodShape = core.$ZodLooseShape, out Config extends core.$ZodObjectConfig = core.$ZodObjectConfig> extends _ZodType<core.$ZodObjectInternals<Shape, Config>>, core.$ZodObject<Shape, Config> {
|
410
399
|
shape: Shape;
|
411
400
|
keyof(): ZodEnum<util.ToEnum<keyof Shape & string>>;
|
412
401
|
/** Define a schema to validate all unrecognized keys. This overrides the existing strict/loose behavior. */
|
413
|
-
catchall<T extends core
|
402
|
+
catchall<T extends core.SomeType>(schema: T): ZodObject<Shape, core.$catchall<T>>;
|
414
403
|
/** @deprecated Use `z.looseObject()` or `.loose()` instead. */
|
415
404
|
passthrough(): ZodObject<Shape, core.$loose>;
|
416
405
|
/** Consider `z.looseObject(A.shape)` instead */
|
@@ -419,12 +408,15 @@ out Shape extends core.$ZodShape = core.$ZodLooseShape, out Config extends core.
|
|
419
408
|
strict(): ZodObject<Shape, core.$strict>;
|
420
409
|
/** This is the default behavior. This method call is likely unnecessary. */
|
421
410
|
strip(): ZodObject<Shape, core.$strict>;
|
422
|
-
extend<U extends core.$ZodLooseShape & Partial<Record<keyof Shape, core
|
411
|
+
extend<U extends core.$ZodLooseShape & Partial<Record<keyof Shape, core.SomeType>>>(shape: U): ZodObject<util.Extend<Shape, U>, Config>;
|
423
412
|
/**
|
424
|
-
* @deprecated Use
|
413
|
+
* @deprecated Use spread syntax and the `.shape` property to combine two object schemas:
|
425
414
|
*
|
426
415
|
* ```ts
|
427
|
-
* z.object({
|
416
|
+
* const A = z.object({ a: z.string() });
|
417
|
+
* const B = z.object({ b: z.number() });
|
418
|
+
*
|
419
|
+
* const C = z.object({
|
428
420
|
* ...A.shape,
|
429
421
|
* ...B.shape
|
430
422
|
* });
|
@@ -447,56 +439,44 @@ out Shape extends core.$ZodShape = core.$ZodLooseShape, out Config extends core.
|
|
447
439
|
}, Config>;
|
448
440
|
}
|
449
441
|
export declare const ZodObject: core.$constructor<ZodObject>;
|
450
|
-
export declare function object<T extends core.$ZodLooseShape = Partial<Record<never, core
|
442
|
+
export declare function object<T extends core.$ZodLooseShape = Partial<Record<never, core.SomeType>>>(shape?: T, params?: string | core.$ZodObjectParams): ZodObject<util.Writeable<T>, core.$strip>;
|
451
443
|
export declare function strictObject<T extends core.$ZodLooseShape>(shape: T, params?: string | core.$ZodObjectParams): ZodObject<T, core.$strict>;
|
452
444
|
export declare function looseObject<T extends core.$ZodLooseShape>(shape: T, params?: string | core.$ZodObjectParams): ZodObject<T, core.$loose>;
|
453
|
-
export interface ZodUnion<T extends readonly core
|
454
|
-
_zod: core.$ZodUnionInternals<T>;
|
445
|
+
export interface ZodUnion<T extends readonly core.SomeType[] = readonly core.$ZodType[]> extends _ZodType<core.$ZodUnionInternals<T>>, core.$ZodUnion<T> {
|
455
446
|
options: T;
|
456
447
|
}
|
457
448
|
export declare const ZodUnion: core.$constructor<ZodUnion>;
|
458
|
-
export declare function union<const T extends readonly core
|
459
|
-
export interface ZodDiscriminatedUnion<Options extends readonly core
|
449
|
+
export declare function union<const T extends readonly core.SomeType[]>(options: T, params?: string | core.$ZodUnionParams): ZodUnion<T>;
|
450
|
+
export interface ZodDiscriminatedUnion<Options extends readonly core.SomeType[] = readonly core.$ZodType[]> extends ZodUnion<Options>, core.$ZodDiscriminatedUnion<Options> {
|
460
451
|
_zod: core.$ZodDiscriminatedUnionInternals<Options>;
|
461
452
|
}
|
462
453
|
export declare const ZodDiscriminatedUnion: core.$constructor<ZodDiscriminatedUnion>;
|
463
|
-
export
|
464
|
-
|
465
|
-
}
|
466
|
-
export interface $ZodTypeDiscriminable extends ZodType {
|
467
|
-
_zod: $ZodTypeDiscriminableInternals;
|
468
|
-
}
|
469
|
-
export declare function discriminatedUnion<Types extends readonly [$ZodTypeDiscriminable, ...$ZodTypeDiscriminable[]]>(discriminator: string, options: Types, params?: string | core.$ZodDiscriminatedUnionParams): ZodDiscriminatedUnion<Types>;
|
470
|
-
export interface ZodIntersection<A extends core.$ZodType = core.$ZodType, B extends core.$ZodType = core.$ZodType> extends ZodType {
|
471
|
-
_zod: core.$ZodIntersectionInternals<A, B>;
|
454
|
+
export declare function discriminatedUnion<Types extends readonly [core.$ZodTypeDiscriminable, ...core.$ZodTypeDiscriminable[]]>(discriminator: string, options: Types, params?: string | core.$ZodDiscriminatedUnionParams): ZodDiscriminatedUnion<Types>;
|
455
|
+
export interface ZodIntersection<A extends core.SomeType = core.$ZodType, B extends core.SomeType = core.$ZodType> extends _ZodType<core.$ZodIntersectionInternals<A, B>>, core.$ZodIntersection<A, B> {
|
472
456
|
}
|
473
457
|
export declare const ZodIntersection: core.$constructor<ZodIntersection>;
|
474
|
-
export declare function intersection<T extends core
|
475
|
-
export interface ZodTuple<T extends util.TupleItems =
|
476
|
-
|
477
|
-
rest<Rest extends core.$ZodType>(rest: Rest): ZodTuple<T, Rest>;
|
458
|
+
export declare function intersection<T extends core.SomeType, U extends core.SomeType>(left: T, right: U): ZodIntersection<T, U>;
|
459
|
+
export interface ZodTuple<T extends util.TupleItems = readonly core.$ZodType[], Rest extends core.SomeType | null = core.$ZodType | null> extends _ZodType<core.$ZodTupleInternals<T, Rest>>, core.$ZodTuple<T, Rest> {
|
460
|
+
rest<Rest extends core.SomeType = core.$ZodType>(rest: Rest): ZodTuple<T, Rest>;
|
478
461
|
}
|
479
462
|
export declare const ZodTuple: core.$constructor<ZodTuple>;
|
480
|
-
export declare function tuple<T extends readonly [core
|
481
|
-
export declare function tuple<T extends readonly [core
|
463
|
+
export declare function tuple<T extends readonly [core.SomeType, ...core.SomeType[]]>(items: T, params?: string | core.$ZodTupleParams): ZodTuple<T, null>;
|
464
|
+
export declare function tuple<T extends readonly [core.SomeType, ...core.SomeType[]], Rest extends core.SomeType>(items: T, rest: Rest, params?: string | core.$ZodTupleParams): ZodTuple<T, Rest>;
|
482
465
|
export declare function tuple(items: [], params?: string | core.$ZodTupleParams): ZodTuple<[], null>;
|
483
|
-
export interface ZodRecord<Key extends core.$ZodRecordKey = core.$ZodRecordKey, Value extends core
|
484
|
-
_zod: core.$ZodRecordInternals<Key, Value>;
|
466
|
+
export interface ZodRecord<Key extends core.$ZodRecordKey = core.$ZodRecordKey, Value extends core.SomeType = core.$ZodType> extends _ZodType<core.$ZodRecordInternals<Key, Value>>, core.$ZodRecord<Key, Value> {
|
485
467
|
keyType: Key;
|
486
468
|
valueType: Value;
|
487
469
|
}
|
488
470
|
export declare const ZodRecord: core.$constructor<ZodRecord>;
|
489
|
-
export declare function record<Key extends core.$ZodRecordKey, Value extends core
|
490
|
-
export declare function partialRecord<Key extends core.$ZodRecordKey, Value extends core
|
491
|
-
export interface ZodMap<Key extends core
|
492
|
-
_zod: core.$ZodMapInternals<Key, Value>;
|
471
|
+
export declare function record<Key extends core.$ZodRecordKey, Value extends core.SomeType>(keyType: Key, valueType: Value, params?: string | core.$ZodRecordParams): ZodRecord<Key, Value>;
|
472
|
+
export declare function partialRecord<Key extends core.$ZodRecordKey, Value extends core.SomeType>(keyType: Key, valueType: Value, params?: string | core.$ZodRecordParams): ZodRecord<ZodUnion<[Key, ZodNever]>, Value>;
|
473
|
+
export interface ZodMap<Key extends core.SomeType = core.$ZodType, Value extends core.SomeType = core.$ZodType> extends _ZodType<core.$ZodMapInternals<Key, Value>>, core.$ZodMap<Key, Value> {
|
493
474
|
keyType: Key;
|
494
475
|
valueType: Value;
|
495
476
|
}
|
496
477
|
export declare const ZodMap: core.$constructor<ZodMap>;
|
497
|
-
export declare function map<Key extends core
|
498
|
-
export interface ZodSet<T extends core
|
499
|
-
_zod: core.$ZodSetInternals<T>;
|
478
|
+
export declare function map<Key extends core.SomeType, Value extends core.SomeType>(keyType: Key, valueType: Value, params?: string | core.$ZodMapParams): ZodMap<Key, Value>;
|
479
|
+
export interface ZodSet<T extends core.SomeType = core.$ZodType> extends ZodType<any, any, core.$ZodSetInternals<T>>, core.$ZodSet<T> {
|
500
480
|
min(minSize: number, params?: string | core.$ZodCheckMinSizeParams): this;
|
501
481
|
/** */
|
502
482
|
nonempty(params?: string | core.$ZodCheckMinSizeParams): this;
|
@@ -504,9 +484,8 @@ export interface ZodSet<T extends core.$ZodType = core.$ZodType> extends ZodType
|
|
504
484
|
size(size: number, params?: string | core.$ZodCheckSizeEqualsParams): this;
|
505
485
|
}
|
506
486
|
export declare const ZodSet: core.$constructor<ZodSet>;
|
507
|
-
export declare function set<Value extends core
|
508
|
-
export interface ZodEnum<T extends util.EnumLike = util.EnumLike> extends
|
509
|
-
_zod: core.$ZodEnumInternals<T>;
|
487
|
+
export declare function set<Value extends core.SomeType>(valueType: Value, params?: string | core.$ZodSetParams): ZodSet<Value>;
|
488
|
+
export interface ZodEnum<out T extends util.EnumLike = util.EnumLike> extends _ZodType<core.$ZodEnumInternals<T>>, core.$ZodEnum<T> {
|
510
489
|
enum: T;
|
511
490
|
options: Array<T[keyof T]>;
|
512
491
|
extract<const U extends readonly (keyof T)[]>(values: U, params?: string | core.$ZodEnumParams): ZodEnum<util.Flatten<Pick<T, U[number]>>>;
|
@@ -524,8 +503,7 @@ export { _enum as enum };
|
|
524
503
|
* ```
|
525
504
|
*/
|
526
505
|
export declare function nativeEnum<T extends util.EnumLike>(entries: T, params?: string | core.$ZodEnumParams): ZodEnum<T>;
|
527
|
-
export interface ZodLiteral<T extends util.Primitive = util.Primitive> extends
|
528
|
-
_zod: core.$ZodLiteralInternals<T>;
|
506
|
+
export interface ZodLiteral<T extends util.Primitive = util.Primitive> extends _ZodType<core.$ZodLiteralInternals<T>>, core.$ZodLiteral<T> {
|
529
507
|
values: Set<T>;
|
530
508
|
/** @legacy Use `.values` instead. Accessing this property will throw an error if the literal accepts multiple values. */
|
531
509
|
value: T;
|
@@ -533,103 +511,87 @@ export interface ZodLiteral<T extends util.Primitive = util.Primitive> extends Z
|
|
533
511
|
export declare const ZodLiteral: core.$constructor<ZodLiteral>;
|
534
512
|
export declare function literal<const T extends Array<util.Literal>>(value: T, params?: string | core.$ZodLiteralParams): ZodLiteral<T[number]>;
|
535
513
|
export declare function literal<const T extends util.Literal>(value: T, params?: string | core.$ZodLiteralParams): ZodLiteral<T>;
|
536
|
-
export interface ZodFile extends
|
537
|
-
_zod: core.$ZodFileInternals;
|
514
|
+
export interface ZodFile extends _ZodType<core.$ZodFileInternals>, core.$ZodFile {
|
538
515
|
min(size: number, params?: string | core.$ZodCheckMinSizeParams): this;
|
539
516
|
max(size: number, params?: string | core.$ZodCheckMaxSizeParams): this;
|
540
|
-
mime(types: Array<util.MimeTypes>, params?: string | core.$ZodCheckMimeTypeParams): this;
|
517
|
+
mime(types: util.MimeTypes | Array<util.MimeTypes>, params?: string | core.$ZodCheckMimeTypeParams): this;
|
541
518
|
}
|
542
519
|
export declare const ZodFile: core.$constructor<ZodFile>;
|
543
520
|
export declare function file(params?: string | core.$ZodFileParams): ZodFile;
|
544
|
-
export interface ZodTransform<O = unknown, I = unknown> extends
|
545
|
-
_zod: core.$ZodTransformInternals<O, I>;
|
521
|
+
export interface ZodTransform<O = unknown, I = unknown> extends _ZodType<core.$ZodTransformInternals<O, I>>, core.$ZodTransform<O, I> {
|
546
522
|
}
|
547
523
|
export declare const ZodTransform: core.$constructor<ZodTransform>;
|
548
524
|
export declare function transform<I = unknown, O = I>(fn: (input: I, ctx: core.ParsePayload) => O): ZodTransform<Awaited<O>, I>;
|
549
|
-
export interface ZodOptional<T extends core
|
550
|
-
_zod: core.$ZodOptionalInternals<T>;
|
525
|
+
export interface ZodOptional<T extends core.SomeType = core.$ZodType> extends _ZodType<core.$ZodOptionalInternals<T>>, core.$ZodOptional<T> {
|
551
526
|
unwrap(): T;
|
552
527
|
}
|
553
528
|
export declare const ZodOptional: core.$constructor<ZodOptional>;
|
554
|
-
export declare function optional<T extends core
|
555
|
-
export interface ZodNullable<T extends core
|
556
|
-
_zod: core.$ZodNullableInternals<T>;
|
529
|
+
export declare function optional<T extends core.SomeType>(innerType: T): ZodOptional<T>;
|
530
|
+
export interface ZodNullable<T extends core.SomeType = core.$ZodType> extends _ZodType<core.$ZodNullableInternals<T>>, core.$ZodNullable<T> {
|
557
531
|
unwrap(): T;
|
558
532
|
}
|
559
533
|
export declare const ZodNullable: core.$constructor<ZodNullable>;
|
560
|
-
export declare function nullable<T extends core
|
561
|
-
export declare function nullish<T extends core
|
562
|
-
export interface ZodDefault<T extends core
|
563
|
-
_zod: core.$ZodDefaultInternals<T>;
|
534
|
+
export declare function nullable<T extends core.SomeType>(innerType: T): ZodNullable<T>;
|
535
|
+
export declare function nullish<T extends core.SomeType>(innerType: T): ZodOptional<ZodNullable<T>>;
|
536
|
+
export interface ZodDefault<T extends core.SomeType = core.$ZodType> extends _ZodType<core.$ZodDefaultInternals<T>>, core.$ZodDefault<T> {
|
564
537
|
unwrap(): T;
|
565
538
|
/** @deprecated Use `.unwrap()` instead. */
|
566
539
|
removeDefault(): T;
|
567
540
|
}
|
568
541
|
export declare const ZodDefault: core.$constructor<ZodDefault>;
|
569
|
-
export declare function _default<T extends core
|
570
|
-
export interface ZodPrefault<T extends core
|
571
|
-
_zod: core.$ZodPrefaultInternals<T>;
|
542
|
+
export declare function _default<T extends core.SomeType>(innerType: T, defaultValue: util.NoUndefined<core.output<T>> | (() => util.NoUndefined<core.output<T>>)): ZodDefault<T>;
|
543
|
+
export interface ZodPrefault<T extends core.SomeType = core.$ZodType> extends _ZodType<core.$ZodPrefaultInternals<T>>, core.$ZodPrefault<T> {
|
572
544
|
unwrap(): T;
|
573
545
|
}
|
574
546
|
export declare const ZodPrefault: core.$constructor<ZodPrefault>;
|
575
|
-
export declare function prefault<T extends core
|
576
|
-
export interface ZodNonOptional<T extends core
|
577
|
-
_zod: core.$ZodNonOptionalInternals<T>;
|
547
|
+
export declare function prefault<T extends core.SomeType>(innerType: T, defaultValue: core.input<T> | (() => core.input<T>)): ZodPrefault<T>;
|
548
|
+
export interface ZodNonOptional<T extends core.SomeType = core.$ZodType> extends _ZodType<core.$ZodNonOptionalInternals<T>>, core.$ZodNonOptional<T> {
|
578
549
|
unwrap(): T;
|
579
550
|
}
|
580
551
|
export declare const ZodNonOptional: core.$constructor<ZodNonOptional>;
|
581
|
-
export declare function nonoptional<T extends core
|
582
|
-
export interface ZodSuccess<T extends core
|
583
|
-
_zod: core.$ZodSuccessInternals<T>;
|
552
|
+
export declare function nonoptional<T extends core.SomeType>(innerType: T, params?: string | core.$ZodNonOptionalParams): ZodNonOptional<T>;
|
553
|
+
export interface ZodSuccess<T extends core.SomeType = core.$ZodType> extends _ZodType<core.$ZodSuccessInternals<T>>, core.$ZodSuccess<T> {
|
584
554
|
unwrap(): T;
|
585
555
|
}
|
586
556
|
export declare const ZodSuccess: core.$constructor<ZodSuccess>;
|
587
|
-
export declare function success<T extends core
|
588
|
-
export interface ZodCatch<T extends core
|
589
|
-
_zod: core.$ZodCatchInternals<T>;
|
557
|
+
export declare function success<T extends core.SomeType>(innerType: T): ZodSuccess<T>;
|
558
|
+
export interface ZodCatch<T extends core.SomeType = core.$ZodType> extends _ZodType<core.$ZodCatchInternals<T>>, core.$ZodCatch<T> {
|
590
559
|
unwrap(): T;
|
591
560
|
/** @deprecated Use `.unwrap()` instead. */
|
592
561
|
removeCatch(): T;
|
593
562
|
}
|
594
563
|
export declare const ZodCatch: core.$constructor<ZodCatch>;
|
595
|
-
declare function _catch<T extends core
|
564
|
+
declare function _catch<T extends core.SomeType>(innerType: T, catchValue: core.output<T> | ((ctx: core.$ZodCatchCtx) => core.output<T>)): ZodCatch<T>;
|
596
565
|
export { _catch as catch };
|
597
|
-
export interface ZodNaN extends
|
598
|
-
_zod: core.$ZodNaNInternals;
|
566
|
+
export interface ZodNaN extends _ZodType<core.$ZodNaNInternals>, core.$ZodNaN {
|
599
567
|
}
|
600
568
|
export declare const ZodNaN: core.$constructor<ZodNaN>;
|
601
569
|
export declare function nan(params?: string | core.$ZodNaNParams): ZodNaN;
|
602
|
-
export interface ZodPipe<A extends core
|
603
|
-
_zod: core.$ZodPipeInternals<A, B>;
|
570
|
+
export interface ZodPipe<A extends core.SomeType = core.$ZodType, B extends core.SomeType = core.$ZodType> extends _ZodType<core.$ZodPipeInternals<A, B>>, core.$ZodPipe<A, B> {
|
604
571
|
in: A;
|
605
572
|
out: B;
|
606
573
|
}
|
607
574
|
export declare const ZodPipe: core.$constructor<ZodPipe>;
|
608
|
-
export declare function pipe<const A extends core
|
609
|
-
export interface ZodReadonly<T extends core
|
610
|
-
_zod: core.$ZodReadonlyInternals<T>;
|
575
|
+
export declare function pipe<const A extends core.SomeType, B extends core.$ZodType<unknown, core.output<A>> = core.$ZodType<unknown, core.output<A>>>(in_: A, out: B | core.$ZodType<unknown, core.output<A>>): ZodPipe<A, B>;
|
576
|
+
export interface ZodReadonly<T extends core.SomeType = core.$ZodType> extends _ZodType<core.$ZodReadonlyInternals<T>>, core.$ZodReadonly<T> {
|
611
577
|
}
|
612
578
|
export declare const ZodReadonly: core.$constructor<ZodReadonly>;
|
613
|
-
export declare function readonly<T extends core
|
614
|
-
export interface ZodTemplateLiteral<Template extends string = string> extends
|
615
|
-
_zod: core.$ZodTemplateLiteralInternals<Template>;
|
579
|
+
export declare function readonly<T extends core.SomeType>(innerType: T): ZodReadonly<T>;
|
580
|
+
export interface ZodTemplateLiteral<Template extends string = string> extends _ZodType<core.$ZodTemplateLiteralInternals<Template>>, core.$ZodTemplateLiteral<Template> {
|
616
581
|
}
|
617
582
|
export declare const ZodTemplateLiteral: core.$constructor<ZodTemplateLiteral>;
|
618
583
|
export declare function templateLiteral<const Parts extends core.$ZodTemplateLiteralPart[]>(parts: Parts, params?: string | core.$ZodTemplateLiteralParams): ZodTemplateLiteral<core.$PartsToTemplateLiteral<Parts>>;
|
619
|
-
export interface ZodLazy<T extends core
|
620
|
-
_zod: core.$ZodLazyInternals<T>;
|
584
|
+
export interface ZodLazy<T extends core.SomeType = core.$ZodType> extends _ZodType<core.$ZodLazyInternals<T>>, core.$ZodLazy<T> {
|
621
585
|
unwrap(): T;
|
622
586
|
}
|
623
587
|
export declare const ZodLazy: core.$constructor<ZodLazy>;
|
624
|
-
export declare function lazy<T extends core
|
625
|
-
export interface ZodPromise<T extends core
|
626
|
-
_zod: core.$ZodPromiseInternals<T>;
|
588
|
+
export declare function lazy<T extends core.SomeType>(getter: () => T): ZodLazy<T>;
|
589
|
+
export interface ZodPromise<T extends core.SomeType = core.$ZodType> extends _ZodType<core.$ZodPromiseInternals<T>>, core.$ZodPromise<T> {
|
627
590
|
unwrap(): T;
|
628
591
|
}
|
629
592
|
export declare const ZodPromise: core.$constructor<ZodPromise>;
|
630
|
-
export declare function promise<T extends core
|
631
|
-
export interface ZodCustom<O = unknown, I = unknown> extends
|
632
|
-
_zod: core.$ZodCustomInternals<O, I>;
|
593
|
+
export declare function promise<T extends core.SomeType>(innerType: T): ZodPromise<T>;
|
594
|
+
export interface ZodCustom<O = unknown, I = unknown> extends _ZodType<core.$ZodCustomInternals<O, I>>, core.$ZodCustom<O, I> {
|
633
595
|
}
|
634
596
|
export declare const ZodCustom: core.$constructor<ZodCustom>;
|
635
597
|
export declare function check<O = unknown>(fn: core.CheckFn<O>, params?: string | core.$ZodCustomParams): core.$ZodCheck<O>;
|
@@ -637,7 +599,7 @@ export declare function custom<O>(fn?: (data: unknown) => unknown, _params?: str
|
|
637
599
|
export declare function refine<T>(fn: (arg: NoInfer<T>) => util.MaybeAsync<unknown>, _params?: string | core.$ZodCustomParams): core.$ZodCheck<T>;
|
638
600
|
export declare function superRefine<T>(fn: (arg: T, payload: RefinementCtx<T>) => void | Promise<void>, params?: string | core.$ZodCustomParams): core.$ZodCheck<T>;
|
639
601
|
type ZodInstanceOfParams = core.Params<ZodCustom, core.$ZodIssueCustom, "type" | "check" | "checks" | "fn" | "abort" | "error" | "params" | "path">;
|
640
|
-
declare function _instanceof<T extends typeof util.Class>(cls: T, params?: ZodInstanceOfParams): ZodCustom<InstanceType<T>>;
|
602
|
+
declare function _instanceof<T extends typeof util.Class>(cls: T, params?: ZodInstanceOfParams): ZodCustom<InstanceType<T>, InstanceType<T>>;
|
641
603
|
export { _instanceof as instanceof };
|
642
604
|
export declare const stringbool: (_params?: string | core.$ZodStringBoolParams) => ZodPipe<ZodUnknown, ZodBoolean>;
|
643
605
|
export type ZodJSONSchema = ZodUnion<[
|
@@ -654,4 +616,4 @@ export type ZodJSONSchema = ZodUnion<[
|
|
654
616
|
};
|
655
617
|
};
|
656
618
|
export declare function json(params?: string | core.$ZodCustomParams): ZodJSONSchema;
|
657
|
-
export declare function preprocess<A, U extends core
|
619
|
+
export declare function preprocess<A, U extends core.SomeType>(fn: (arg: unknown, ctx: RefinementCtx) => A, schema: U): ZodPipe<ZodTransform<A, unknown>, U>;
|
@@ -195,7 +195,7 @@ export type $ZodObjectParams = TypeParams<schemas.$ZodObject, "shape" | "catchal
|
|
195
195
|
export type $ZodUnionParams = TypeParams<schemas.$ZodUnion, "options">;
|
196
196
|
export declare function _union<const T extends readonly schemas.$ZodObject[]>(Class: util.SchemaClass<schemas.$ZodUnion>, options: T, params?: string | $ZodUnionParams): schemas.$ZodUnion<T>;
|
197
197
|
export interface $ZodTypeDiscriminableInternals extends schemas.$ZodTypeInternals {
|
198
|
-
|
198
|
+
propValues: util.PropValues;
|
199
199
|
}
|
200
200
|
export interface $ZodTypeDiscriminable extends schemas.$ZodType {
|
201
201
|
_zod: $ZodTypeDiscriminableInternals;
|
@@ -255,7 +255,7 @@ export type $ZodPromiseParams = TypeParams<schemas.$ZodPromise, "innerType">;
|
|
255
255
|
export declare function _promise<T extends schemas.$ZodObject>(Class: util.SchemaClass<schemas.$ZodPromise>, innerType: T): schemas.$ZodPromise<T>;
|
256
256
|
export type $ZodCustomParams = CheckTypeParams<schemas.$ZodCustom, "fn">;
|
257
257
|
export declare function _custom<O = unknown, I = O>(Class: util.SchemaClass<schemas.$ZodCustom>, fn: (data: O) => unknown, _params: string | $ZodCustomParams | undefined): schemas.$ZodCustom<O, I>;
|
258
|
-
export declare function _refine<
|
258
|
+
export declare function _refine<O = unknown, I = O>(Class: util.SchemaClass<schemas.$ZodCustom>, fn: (data: O) => unknown, _params: string | $ZodCustomParams | undefined): schemas.$ZodCustom<O, I>;
|
259
259
|
export interface $ZodStringBoolParams extends TypeParams {
|
260
260
|
truthy?: string[];
|
261
261
|
falsy?: string[];
|
@@ -20,16 +20,20 @@ export type $brand<T extends string | number | symbol = string | number | symbol
|
|
20
20
|
[k in T]: true;
|
21
21
|
};
|
22
22
|
};
|
23
|
-
export type $ZodBranded<T extends schemas
|
23
|
+
export type $ZodBranded<T extends schemas._$ZodType, Brand extends string | number | symbol> = T & Record<"_zod", Record<"output", output<T> & $brand<Brand>>>;
|
24
24
|
export declare class $ZodAsyncError extends Error {
|
25
25
|
constructor();
|
26
26
|
}
|
27
|
-
export type input<T
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
27
|
+
export type input<T> = T extends {
|
28
|
+
_zod: {
|
29
|
+
input: any;
|
30
|
+
};
|
31
|
+
} ? Required<T["_zod"]>["input"] : unknown;
|
32
|
+
export type output<T> = T extends {
|
33
|
+
_zod: {
|
34
|
+
output: any;
|
35
|
+
};
|
36
|
+
} ? Required<T["_zod"]>["output"] : unknown;
|
33
37
|
export type { output as infer };
|
34
38
|
export interface $ZodConfig {
|
35
39
|
/** Custom error map. Overrides `config().localeError`. */
|
@@ -132,7 +132,6 @@ type _FlattenedError<T, U = string> = {
|
|
132
132
|
[P in keyof T]?: U[];
|
133
133
|
};
|
134
134
|
};
|
135
|
-
/** @deprecated Use `z.treeifyError()` instead. */
|
136
135
|
export declare function flattenError<T>(error: $ZodError<T>): _FlattenedError<T>;
|
137
136
|
export declare function flattenError<T, U>(error: $ZodError<T>, mapper?: (issue: $ZodIssue) => U): _FlattenedError<T, U>;
|
138
137
|
type _ZodFormattedError<T, U = string> = T extends [any, ...any[]] ? {
|
@@ -1,3 +1,4 @@
|
|
1
|
+
import type * as core from "./core.js";
|
1
2
|
import * as schemas from "./schemas.js";
|
2
3
|
import { $ZodTuple } from "./schemas.js";
|
3
4
|
import type * as util from "./util.js";
|
@@ -7,12 +8,12 @@ export interface $ZodFunctionDef<In extends $ZodFunctionIn = $ZodFunctionIn, Out
|
|
7
8
|
output: Out;
|
8
9
|
}
|
9
10
|
export type $ZodFunctionArgs = schemas.$ZodType<unknown[], unknown[]>;
|
10
|
-
export type $ZodFunctionIn = $ZodFunctionArgs
|
11
|
-
export type $ZodFunctionOut = schemas.$ZodType
|
12
|
-
export type $InferInnerFunctionType<Args extends $ZodFunctionIn, Returns extends $ZodFunctionOut> = (...args:
|
13
|
-
export type $InferInnerFunctionTypeAsync<Args extends $ZodFunctionIn, Returns extends $ZodFunctionOut> = (...args:
|
14
|
-
export type $InferOuterFunctionType<Args extends $ZodFunctionIn, Returns extends $ZodFunctionOut> = (...args:
|
15
|
-
export type $InferOuterFunctionTypeAsync<Args extends $ZodFunctionIn, Returns extends $ZodFunctionOut> = (...args:
|
11
|
+
export type $ZodFunctionIn = $ZodFunctionArgs;
|
12
|
+
export type $ZodFunctionOut = schemas.$ZodType;
|
13
|
+
export type $InferInnerFunctionType<Args extends $ZodFunctionIn, Returns extends $ZodFunctionOut> = (...args: $ZodFunctionIn extends Args ? never[] : core.output<Args>) => core.input<Returns>;
|
14
|
+
export type $InferInnerFunctionTypeAsync<Args extends $ZodFunctionIn, Returns extends $ZodFunctionOut> = (...args: $ZodFunctionIn extends Args ? never[] : core.output<Args>) => util.MaybeAsync<core.input<Returns>>;
|
15
|
+
export type $InferOuterFunctionType<Args extends $ZodFunctionIn, Returns extends $ZodFunctionOut> = (...args: $ZodFunctionIn extends Args ? never[] : core.input<Args>) => core.output<Returns>;
|
16
|
+
export type $InferOuterFunctionTypeAsync<Args extends $ZodFunctionIn, Returns extends $ZodFunctionOut> = (...args: $ZodFunctionIn extends Args ? never[] : core.input<Args>) => util.MaybeAsync<core.output<Returns>>;
|
16
17
|
export declare class $ZodFunction<Args extends $ZodFunctionIn = $ZodFunctionIn, Returns extends $ZodFunctionOut = $ZodFunctionOut> {
|
17
18
|
def: $ZodFunctionDef<Args, Returns>;
|
18
19
|
/** @deprecated */
|
@@ -20,9 +21,9 @@ export declare class $ZodFunction<Args extends $ZodFunctionIn = $ZodFunctionIn,
|
|
20
21
|
_input: $InferInnerFunctionType<Args, Returns>;
|
21
22
|
_output: $InferOuterFunctionType<Args, Returns>;
|
22
23
|
constructor(def: $ZodFunctionDef<Args, Returns>);
|
23
|
-
implement<F extends $InferInnerFunctionType<Args, Returns>>(func: F): F extends this["_output"] ? F : this["_output"]
|
24
|
+
implement<F extends $InferInnerFunctionType<Args, Returns>>(func: F): (...args: Parameters<this["_output"]>) => ReturnType<F> extends ReturnType<this["_output"]> ? ReturnType<F> : ReturnType<this["_output"]>;
|
24
25
|
implementAsync<F extends $InferInnerFunctionTypeAsync<Args, Returns>>(func: F): F extends $InferOuterFunctionTypeAsync<Args, Returns> ? F : $InferOuterFunctionTypeAsync<Args, Returns>;
|
25
|
-
input<const Items extends util.TupleItems, const Rest extends $ZodFunctionOut =
|
26
|
+
input<const Items extends util.TupleItems, const Rest extends $ZodFunctionOut = $ZodFunctionOut>(args: Items, rest?: Rest): $ZodFunction<schemas.$ZodTuple<Items, Rest>, Returns>;
|
26
27
|
input<NewArgs extends $ZodFunctionIn>(args: NewArgs): $ZodFunction<NewArgs, Returns>;
|
27
28
|
output<NewReturns extends schemas.$ZodType>(output: NewReturns): $ZodFunction<Args, NewReturns>;
|
28
29
|
}
|
@@ -33,13 +34,17 @@ export interface $ZodFunctionParams<I extends $ZodFunctionIn, O extends schemas.
|
|
33
34
|
declare function _function(): $ZodFunction;
|
34
35
|
declare function _function<const In extends Array<schemas.$ZodType> = Array<schemas.$ZodType>>(params: {
|
35
36
|
input: In;
|
36
|
-
}): $ZodFunction<$ZodTuple<In, null>,
|
37
|
+
}): $ZodFunction<$ZodTuple<In, null>, $ZodFunctionOut>;
|
38
|
+
declare function _function<const In extends Array<schemas.$ZodType> = Array<schemas.$ZodType>, const Out extends $ZodFunctionOut = $ZodFunctionOut>(params: {
|
39
|
+
input: In;
|
40
|
+
output: Out;
|
41
|
+
}): $ZodFunction<$ZodTuple<In, null>, Out>;
|
37
42
|
declare function _function<const In extends $ZodFunctionIn = $ZodFunctionIn>(params: {
|
38
43
|
input: In;
|
39
|
-
}): $ZodFunction<In,
|
44
|
+
}): $ZodFunction<In, $ZodFunctionOut>;
|
40
45
|
declare function _function<const Out extends $ZodFunctionOut = $ZodFunctionOut>(params: {
|
41
46
|
output: Out;
|
42
|
-
}): $ZodFunction
|
47
|
+
}): $ZodFunction<$ZodFunctionIn, Out>;
|
43
48
|
declare function _function<In extends $ZodFunctionIn = $ZodFunctionIn, Out extends schemas.$ZodType = schemas.$ZodType>(params?: {
|
44
49
|
input: In;
|
45
50
|
output: Out;
|
@@ -32,10 +32,10 @@ export declare const ipv4: RegExp;
|
|
32
32
|
export declare const ipv6: RegExp;
|
33
33
|
export declare const cidrv4: RegExp;
|
34
34
|
export declare const cidrv6: RegExp;
|
35
|
-
export declare const ip: RegExp;
|
36
35
|
export declare const base64: RegExp;
|
37
36
|
export declare const base64url: RegExp;
|
38
37
|
export declare const hostname: RegExp;
|
38
|
+
export declare const domain: RegExp;
|
39
39
|
export declare const e164: RegExp;
|
40
40
|
export declare const date: RegExp;
|
41
41
|
export declare function time(args: {
|