zod-compiler 0.1.0
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 +40 -0
- package/dist/index.d.ts +670 -0
- package/dist/index.js +2550 -0
- package/dist/index.mjs +2536 -0
- package/dist/standalone.d.ts +294 -0
- package/dist/standalone.js +523 -0
- package/dist/standalone.mjs +514 -0
- package/package.json +53 -0
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,670 @@
|
|
|
1
|
+
import z from 'zod';
|
|
2
|
+
import ts from 'typescript';
|
|
3
|
+
import { ParseStatus, CompiledParser } from './standalone.js';
|
|
4
|
+
export { CompiledParser } from './standalone.js';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* In JavaScript, there exist two main types of values - primitives like strings, numbers, and booleans; and objects like
|
|
8
|
+
* arrays, `Map`s, `Set`s, and, well, *objects*. Two primitives with equal value are equal to each other: `42 === 42` and
|
|
9
|
+
* `"foo" === "foo"`, however ***two objects will never be equal to each other***: `{} !== {}`, `[] !== []`.
|
|
10
|
+
*
|
|
11
|
+
* Since `zod-compiler` outputs source code which is then {@linkcode eval}uated, it has to get values defined in types
|
|
12
|
+
* like `z.literal()` or `.default()` or `.catch()` from *somewhere*; for primitive types this is fine, and the value can
|
|
13
|
+
* be directly pasted into the source code. However, for objects, this can lead to unexpected behavior if you, for example,
|
|
14
|
+
* expect values returned by `.default()` to be equal to the original value provided in the schema definition.
|
|
15
|
+
*
|
|
16
|
+
* The default inlining mode is {@linkcode Default}, which inlines *primitives*, but not *objects*. This means that
|
|
17
|
+
* any object values are defined as a **dependency**; they are the *exact same values* taken from the schema definition
|
|
18
|
+
* that the compiled parser can use via a reference. This behavior provides the best compatibility for in-source usage of
|
|
19
|
+
* `zod-compiler`.
|
|
20
|
+
*
|
|
21
|
+
* For **standalone** builds, however, that would mean that you'd have to provide these dependency references to the parser.
|
|
22
|
+
* `zc.compile()` returns a dependency array which you could then pass to `standalone()`, though you'd have to figure
|
|
23
|
+
* out where those values come from and extract them out of your source tree. Alternatively, the {@linkcode InliningMode.Aggressive Aggressive}
|
|
24
|
+
* inlining mode *will* attempt to inline objects, arrays, `Map`s, and `Set`s. This does mean that these values would
|
|
25
|
+
* no longer be equivalent to their definition, but there's a good chance you don't depend on that behavior anyway.
|
|
26
|
+
*/
|
|
27
|
+
declare enum InliningMode {
|
|
28
|
+
/** Does not inline any values; they will all be added as dependencies. */
|
|
29
|
+
None = 0,
|
|
30
|
+
/** Inlines most primitives: strings, numbers, `BigInt`s, booleans, and `null`/`undefined`. */
|
|
31
|
+
Default = 1,
|
|
32
|
+
/**
|
|
33
|
+
* Like {@linkcode InliningMode.Default Default}, but also inlines objects, arrays, `Map`s and `Set`s, and regular
|
|
34
|
+
* expressions.
|
|
35
|
+
*
|
|
36
|
+
* Symbols and functions cannot be inlined.
|
|
37
|
+
*/
|
|
38
|
+
Aggressive = 2
|
|
39
|
+
}
|
|
40
|
+
declare class Dependencies {
|
|
41
|
+
private readonly verifierContext;
|
|
42
|
+
private readonly inliningMode;
|
|
43
|
+
private readonly _dependencies;
|
|
44
|
+
constructor(verifierContext: ts.Expression, inliningMode: InliningMode);
|
|
45
|
+
add(value: any): ts.Expression;
|
|
46
|
+
addOrInline(value: any): ts.Expression;
|
|
47
|
+
get dependencies(): readonly any[];
|
|
48
|
+
}
|
|
49
|
+
interface IGeneratorContext {
|
|
50
|
+
get dependencies(): Dependencies;
|
|
51
|
+
get input(): ts.Expression;
|
|
52
|
+
get verifierContext(): ts.Expression;
|
|
53
|
+
prelude(): Iterable<ts.Statement>;
|
|
54
|
+
postlude(): Iterable<ts.Statement>;
|
|
55
|
+
outputs(expr: ts.Expression): Iterable<ts.Statement>;
|
|
56
|
+
withInput(expr: ts.Expression): this;
|
|
57
|
+
report(issue: ts.Expression, input?: ts.Expression): Iterable<ts.Statement>;
|
|
58
|
+
status(status: ParseStatus | ts.Expression, allowShortCircuiting?: boolean): Iterable<ts.Statement>;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
declare enum ZcParsedType {
|
|
62
|
+
string = "string",
|
|
63
|
+
nan = "nan",
|
|
64
|
+
number = "number",
|
|
65
|
+
integer = "integer",
|
|
66
|
+
float = "float",
|
|
67
|
+
boolean = "boolean",
|
|
68
|
+
date = "date",
|
|
69
|
+
bigint = "bigint",
|
|
70
|
+
symbol = "symbol",
|
|
71
|
+
function = "function",
|
|
72
|
+
undefined = "undefined",
|
|
73
|
+
null = "null",
|
|
74
|
+
array = "array",
|
|
75
|
+
object = "object",
|
|
76
|
+
unknown = "unknown",
|
|
77
|
+
promise = "promise",
|
|
78
|
+
void = "void",
|
|
79
|
+
never = "never",
|
|
80
|
+
map = "map",
|
|
81
|
+
set = "set"
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
declare class Path {
|
|
85
|
+
private readonly parts;
|
|
86
|
+
protected constructor(parts: ts.Expression[]);
|
|
87
|
+
static empty(): Path;
|
|
88
|
+
get isEmpty(): boolean;
|
|
89
|
+
clone(): Path;
|
|
90
|
+
push(fragment: string | number | ts.Expression): Path;
|
|
91
|
+
serialize(): ts.ArrayLiteralExpression;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
declare abstract class AbstractCompiledType<TZod extends z.ZodType> {
|
|
95
|
+
protected readonly type: TZod;
|
|
96
|
+
constructor(type: TZod);
|
|
97
|
+
abstract compileType(): ts.TypeNode;
|
|
98
|
+
abstract compileParser(ctx: IGeneratorContext, path: Path): Iterable<ts.Statement>;
|
|
99
|
+
}
|
|
100
|
+
declare function compilable<TZod extends z.ZodTypeAny>(type: TZod): AbstractCompiledType<TZod>;
|
|
101
|
+
|
|
102
|
+
type Primitive = string | number | symbol | bigint | boolean | null | undefined;
|
|
103
|
+
type Scalars = Primitive | Primitive[];
|
|
104
|
+
type typeToFlattenedError<T, U = string> = {
|
|
105
|
+
formErrors: U[];
|
|
106
|
+
fieldErrors: {
|
|
107
|
+
[P in keyof T]?: U[];
|
|
108
|
+
};
|
|
109
|
+
};
|
|
110
|
+
declare enum ZcIssueCode {
|
|
111
|
+
invalid_type = "invalid_type",
|
|
112
|
+
invalid_literal = "invalid_literal",
|
|
113
|
+
custom = "custom",
|
|
114
|
+
invalid_union = "invalid_union",
|
|
115
|
+
invalid_union_discriminator = "invalid_union_discriminator",
|
|
116
|
+
invalid_enum_value = "invalid_enum_value",
|
|
117
|
+
unrecognized_keys = "unrecognized_keys",
|
|
118
|
+
invalid_arguments = "invalid_arguments",
|
|
119
|
+
invalid_return_type = "invalid_return_type",
|
|
120
|
+
invalid_date = "invalid_date",
|
|
121
|
+
invalid_string = "invalid_string",
|
|
122
|
+
too_small = "too_small",
|
|
123
|
+
too_big = "too_big",
|
|
124
|
+
invalid_intersection_types = "invalid_intersection_types",
|
|
125
|
+
not_multiple_of = "not_multiple_of",
|
|
126
|
+
not_finite = "not_finite"
|
|
127
|
+
}
|
|
128
|
+
interface ZcIssueBase {
|
|
129
|
+
path: (string | number)[];
|
|
130
|
+
message?: string;
|
|
131
|
+
}
|
|
132
|
+
interface ZcInvalidTypeIssue extends ZcIssueBase {
|
|
133
|
+
code: ZcIssueCode.invalid_type;
|
|
134
|
+
expected: ZcParsedType;
|
|
135
|
+
received: ZcParsedType;
|
|
136
|
+
}
|
|
137
|
+
interface ZcInvalidLiteralIssue extends ZcIssueBase {
|
|
138
|
+
code: ZcIssueCode.invalid_literal;
|
|
139
|
+
expected: unknown;
|
|
140
|
+
received: unknown;
|
|
141
|
+
}
|
|
142
|
+
interface ZcUnrecognizedKeysIssue extends ZcIssueBase {
|
|
143
|
+
code: ZcIssueCode.unrecognized_keys;
|
|
144
|
+
keys: string[];
|
|
145
|
+
}
|
|
146
|
+
interface ZcInvalidUnionIssue extends ZcIssueBase {
|
|
147
|
+
code: ZcIssueCode.invalid_union;
|
|
148
|
+
unionErrors: ZcError[];
|
|
149
|
+
}
|
|
150
|
+
interface ZcInvalidUnionDiscriminatorIssue extends ZcIssueBase {
|
|
151
|
+
code: ZcIssueCode.invalid_union_discriminator;
|
|
152
|
+
options: Primitive[];
|
|
153
|
+
}
|
|
154
|
+
interface ZcInvalidEnumValueIssue extends ZcIssueBase {
|
|
155
|
+
code: ZcIssueCode.invalid_enum_value;
|
|
156
|
+
received: string | number;
|
|
157
|
+
options: (string | number)[];
|
|
158
|
+
}
|
|
159
|
+
interface ZcInvalidArgumentsIssue extends ZcIssueBase {
|
|
160
|
+
code: ZcIssueCode.invalid_arguments;
|
|
161
|
+
argumentsError: ZcError;
|
|
162
|
+
}
|
|
163
|
+
interface ZcInvalidReturnTypeIssue extends ZcIssueBase {
|
|
164
|
+
code: ZcIssueCode.invalid_return_type;
|
|
165
|
+
returnTypeError: ZcError;
|
|
166
|
+
}
|
|
167
|
+
interface ZcInvalidDateIssue extends ZcIssueBase {
|
|
168
|
+
code: ZcIssueCode.invalid_date;
|
|
169
|
+
}
|
|
170
|
+
type StringValidation = 'email' | 'url' | 'emoji' | 'uuid' | 'nanoid' | 'regex' | 'cuid' | 'cuid2' | 'ulid' | 'datetime' | 'date' | 'time' | 'duration' | 'ip' | 'cidr' | 'base64' | 'jwt' | 'base64url' | {
|
|
171
|
+
includes: string;
|
|
172
|
+
position?: number;
|
|
173
|
+
} | {
|
|
174
|
+
startsWith: string;
|
|
175
|
+
} | {
|
|
176
|
+
endsWith: string;
|
|
177
|
+
};
|
|
178
|
+
interface ZcInvalidStringIssue extends ZcIssueBase {
|
|
179
|
+
code: ZcIssueCode.invalid_string;
|
|
180
|
+
validation: StringValidation;
|
|
181
|
+
}
|
|
182
|
+
interface ZcTooSmallIssue extends ZcIssueBase {
|
|
183
|
+
code: ZcIssueCode.too_small;
|
|
184
|
+
minimum: number | bigint;
|
|
185
|
+
inclusive: boolean;
|
|
186
|
+
exact?: boolean;
|
|
187
|
+
type: 'array' | 'string' | 'number' | 'set' | 'date' | 'bigint';
|
|
188
|
+
}
|
|
189
|
+
interface ZcTooBigIssue extends ZcIssueBase {
|
|
190
|
+
code: ZcIssueCode.too_big;
|
|
191
|
+
maximum: number | bigint;
|
|
192
|
+
inclusive: boolean;
|
|
193
|
+
exact?: boolean;
|
|
194
|
+
type: 'array' | 'string' | 'number' | 'set' | 'date' | 'bigint';
|
|
195
|
+
}
|
|
196
|
+
interface ZcInvalidIntersectionTypesIssue extends ZcIssueBase {
|
|
197
|
+
code: ZcIssueCode.invalid_intersection_types;
|
|
198
|
+
}
|
|
199
|
+
interface ZcNotMultipleOfIssue extends ZcIssueBase {
|
|
200
|
+
code: ZcIssueCode.not_multiple_of;
|
|
201
|
+
multipleOf: number | bigint;
|
|
202
|
+
}
|
|
203
|
+
interface ZcNotFiniteIssue extends ZcIssueBase {
|
|
204
|
+
code: ZcIssueCode.not_finite;
|
|
205
|
+
}
|
|
206
|
+
interface ZcCustomIssue extends ZcIssueBase {
|
|
207
|
+
code: ZcIssueCode.custom;
|
|
208
|
+
params?: {
|
|
209
|
+
[k: string]: any;
|
|
210
|
+
};
|
|
211
|
+
}
|
|
212
|
+
type DenormalizedError = {
|
|
213
|
+
[k: string]: DenormalizedError | string[];
|
|
214
|
+
};
|
|
215
|
+
type ZcIssueOptionalMessage = ZcInvalidTypeIssue | ZcInvalidLiteralIssue | ZcUnrecognizedKeysIssue | ZcInvalidUnionIssue | ZcInvalidUnionDiscriminatorIssue | ZcInvalidEnumValueIssue | ZcInvalidArgumentsIssue | ZcInvalidReturnTypeIssue | ZcInvalidDateIssue | ZcInvalidStringIssue | ZcTooSmallIssue | ZcTooBigIssue | ZcInvalidIntersectionTypesIssue | ZcNotMultipleOfIssue | ZcNotFiniteIssue | ZcCustomIssue;
|
|
216
|
+
type ZcIssue = ZcIssueOptionalMessage & {
|
|
217
|
+
fatal?: boolean;
|
|
218
|
+
message: string;
|
|
219
|
+
};
|
|
220
|
+
type recursiveZcFormattedError<T> = T extends [any, ...any[]] ? {
|
|
221
|
+
[K in keyof T]?: ZcFormattedError<T[K]>;
|
|
222
|
+
} : T extends any[] ? {
|
|
223
|
+
[k: number]: ZcFormattedError<T[number]>;
|
|
224
|
+
} : T extends object ? {
|
|
225
|
+
[K in keyof T]?: ZcFormattedError<T[K]>;
|
|
226
|
+
} : unknown;
|
|
227
|
+
type ZcFormattedError<T, U = string> = {
|
|
228
|
+
_errors: U[];
|
|
229
|
+
} & recursiveZcFormattedError<NonNullable<T>>;
|
|
230
|
+
declare class ZcError<T = any> extends Error {
|
|
231
|
+
issues: ZcIssue[];
|
|
232
|
+
get errors(): ZcIssue[];
|
|
233
|
+
constructor(issues: ZcIssue[]);
|
|
234
|
+
format(): ZcFormattedError<T>;
|
|
235
|
+
format<U>(mapper: (issue: ZcIssue) => U): ZcFormattedError<T, U>;
|
|
236
|
+
static create(issues: ZcIssue[]): ZcError;
|
|
237
|
+
toString(): string;
|
|
238
|
+
get message(): string;
|
|
239
|
+
get isEmpty(): boolean;
|
|
240
|
+
addIssue(sub: ZcIssue): void;
|
|
241
|
+
addIssues(subs?: ZcIssue[]): void;
|
|
242
|
+
flatten(): typeToFlattenedError<T>;
|
|
243
|
+
flatten<U>(mapper?: (issue: ZcIssue) => U): typeToFlattenedError<T, U>;
|
|
244
|
+
get formErrors(): typeToFlattenedError<T>;
|
|
245
|
+
}
|
|
246
|
+
type IssueData = Omit<ZcIssueOptionalMessage, 'path'> & {
|
|
247
|
+
path?: (string | number)[];
|
|
248
|
+
fatal?: boolean;
|
|
249
|
+
};
|
|
250
|
+
type ErrorMapCtx = {
|
|
251
|
+
defaultError: string;
|
|
252
|
+
data: any;
|
|
253
|
+
};
|
|
254
|
+
type ZcErrorMap = (issue: ZcIssueOptionalMessage, ctx: ErrorMapCtx) => {
|
|
255
|
+
message: string;
|
|
256
|
+
};
|
|
257
|
+
|
|
258
|
+
declare class ZcAny extends AbstractCompiledType<z.ZodAny> {
|
|
259
|
+
compileType(): ts.TypeNode;
|
|
260
|
+
compileParser(ctx: IGeneratorContext, path: Path): Iterable<ts.Statement>;
|
|
261
|
+
}
|
|
262
|
+
|
|
263
|
+
declare class ZcArray<TZod extends z.ZodType> extends AbstractCompiledType<z.ZodArray<TZod>> {
|
|
264
|
+
compileType(): ts.TypeNode;
|
|
265
|
+
compileParser(ctx: IGeneratorContext, path: Path): Generator<ts.Statement>;
|
|
266
|
+
}
|
|
267
|
+
|
|
268
|
+
declare class ZcBigInt extends AbstractCompiledType<z.ZodBigInt> {
|
|
269
|
+
compileType(): ts.TypeNode;
|
|
270
|
+
compileParser(ctx: IGeneratorContext, path: Path): Iterable<ts.Statement>;
|
|
271
|
+
}
|
|
272
|
+
|
|
273
|
+
declare class ZcBoolean extends AbstractCompiledType<z.ZodBoolean> {
|
|
274
|
+
compileType(): ts.TypeNode;
|
|
275
|
+
compileParser(ctx: IGeneratorContext, path: Path): Iterable<ts.Statement>;
|
|
276
|
+
}
|
|
277
|
+
|
|
278
|
+
declare class ZcBranded<TZod extends z.ZodTypeAny, B extends string | number | symbol> extends AbstractCompiledType<z.ZodBranded<TZod, B>> {
|
|
279
|
+
compileType(): ts.TypeNode;
|
|
280
|
+
compileParser(ctx: IGeneratorContext, path: Path): Iterable<ts.Statement>;
|
|
281
|
+
}
|
|
282
|
+
|
|
283
|
+
declare class ZcCatch<TZod extends z.ZodType> extends AbstractCompiledType<z.ZodCatch<TZod>> {
|
|
284
|
+
compileType(): ts.TypeNode;
|
|
285
|
+
compileParser(ctx: IGeneratorContext, path: Path): Generator<ts.Statement>;
|
|
286
|
+
}
|
|
287
|
+
|
|
288
|
+
declare class ZcDate extends AbstractCompiledType<z.ZodDate> {
|
|
289
|
+
compileType(): ts.TypeNode;
|
|
290
|
+
compileParser(ctx: IGeneratorContext, path: Path): Iterable<ts.Statement>;
|
|
291
|
+
}
|
|
292
|
+
|
|
293
|
+
declare class ZcDefault<TZod extends z.ZodType> extends AbstractCompiledType<z.ZodDefault<TZod>> {
|
|
294
|
+
compileType(): ts.TypeNode;
|
|
295
|
+
compileParser(ctx: IGeneratorContext, path: Path): Generator<ts.Statement>;
|
|
296
|
+
}
|
|
297
|
+
|
|
298
|
+
declare class ZcDiscriminatedUnion<TDiscriminator extends string, TOptions extends readonly z.ZodDiscriminatedUnionOption<TDiscriminator>[]> extends AbstractCompiledType<z.ZodDiscriminatedUnion<TDiscriminator, TOptions>> {
|
|
299
|
+
compileType(): ts.TypeNode;
|
|
300
|
+
compileParser(ctx: IGeneratorContext, path: Path): Iterable<ts.Statement>;
|
|
301
|
+
}
|
|
302
|
+
|
|
303
|
+
declare class ZcEnum<T extends [string, ...string[]]> extends AbstractCompiledType<z.ZodEnum<T>> {
|
|
304
|
+
compileType(): ts.TypeNode;
|
|
305
|
+
compileParser(ctx: IGeneratorContext, path: Path): Iterable<ts.Statement>;
|
|
306
|
+
}
|
|
307
|
+
|
|
308
|
+
declare class ZcIntersection<T extends z.ZodTypeAny, U extends z.ZodTypeAny> extends AbstractCompiledType<z.ZodIntersection<T, U>> {
|
|
309
|
+
compileType(): ts.TypeNode;
|
|
310
|
+
compileParser(ctx: IGeneratorContext, path: Path): Generator<ts.Statement>;
|
|
311
|
+
private _generateSide;
|
|
312
|
+
}
|
|
313
|
+
|
|
314
|
+
declare class ZcLiteral<T> extends AbstractCompiledType<z.ZodLiteral<T>> {
|
|
315
|
+
compileType(): ts.TypeNode;
|
|
316
|
+
compileParser(ctx: IGeneratorContext, path: Path): Iterable<ts.Statement>;
|
|
317
|
+
}
|
|
318
|
+
|
|
319
|
+
declare class ZcMap<K extends z.ZodTypeAny, V extends z.ZodTypeAny> extends AbstractCompiledType<z.ZodMap<K, V>> {
|
|
320
|
+
compileType(): ts.TypeNode;
|
|
321
|
+
compileParser(ctx: IGeneratorContext, path: Path): Generator<ts.Statement>;
|
|
322
|
+
}
|
|
323
|
+
|
|
324
|
+
declare class ZcNaN extends AbstractCompiledType<z.ZodNaN> {
|
|
325
|
+
compileType(): ts.TypeNode;
|
|
326
|
+
compileParser(ctx: IGeneratorContext, path: Path): Iterable<ts.Statement>;
|
|
327
|
+
}
|
|
328
|
+
|
|
329
|
+
declare class ZcNativeEnum<T extends z.EnumLike> extends AbstractCompiledType<z.ZodNativeEnum<T>> {
|
|
330
|
+
compileType(): ts.TypeNode;
|
|
331
|
+
compileParser(ctx: IGeneratorContext, path: Path): Iterable<ts.Statement>;
|
|
332
|
+
}
|
|
333
|
+
|
|
334
|
+
declare class ZcNever extends AbstractCompiledType<z.ZodNever> {
|
|
335
|
+
compileType(): ts.TypeNode;
|
|
336
|
+
compileParser(ctx: IGeneratorContext, path: Path): Iterable<ts.Statement>;
|
|
337
|
+
}
|
|
338
|
+
|
|
339
|
+
declare class ZcNull extends AbstractCompiledType<z.ZodNull> {
|
|
340
|
+
compileType(): ts.TypeNode;
|
|
341
|
+
compileParser(ctx: IGeneratorContext, path: Path): Iterable<ts.Statement>;
|
|
342
|
+
}
|
|
343
|
+
|
|
344
|
+
declare class ZcNullable<TZod extends z.ZodType> extends AbstractCompiledType<z.ZodNullable<TZod>> {
|
|
345
|
+
compileType(): ts.TypeNode;
|
|
346
|
+
compileParser(ctx: IGeneratorContext, path: Path): Generator<ts.Statement>;
|
|
347
|
+
}
|
|
348
|
+
|
|
349
|
+
declare class ZcNumber extends AbstractCompiledType<z.ZodNumber> {
|
|
350
|
+
compileType(): ts.TypeNode;
|
|
351
|
+
compileParser(ctx: IGeneratorContext, path: Path): Iterable<ts.Statement>;
|
|
352
|
+
}
|
|
353
|
+
|
|
354
|
+
declare class ZcObject<TZod extends z.ZodRawShape> extends AbstractCompiledType<z.ZodObject<TZod>> {
|
|
355
|
+
canSkipTypeCheck: boolean;
|
|
356
|
+
compileType(): ts.TypeNode;
|
|
357
|
+
compileParser(ctx: IGeneratorContext, path: Path): Generator<ts.Statement>;
|
|
358
|
+
}
|
|
359
|
+
|
|
360
|
+
declare class ZcOptional<TZod extends z.ZodType> extends AbstractCompiledType<z.ZodOptional<TZod>> {
|
|
361
|
+
compileType(): ts.TypeNode;
|
|
362
|
+
compileParser(ctx: IGeneratorContext, path: Path): Generator<ts.Statement>;
|
|
363
|
+
}
|
|
364
|
+
|
|
365
|
+
declare class ZcReadonly<TZod extends z.ZodTypeAny> extends AbstractCompiledType<z.ZodReadonly<TZod>> {
|
|
366
|
+
compileType(): ts.TypeNode;
|
|
367
|
+
compileParser(ctx: IGeneratorContext, path: Path): Iterable<ts.Statement>;
|
|
368
|
+
}
|
|
369
|
+
|
|
370
|
+
declare class ZcRecord<K extends z.KeySchema, V extends z.ZodTypeAny> extends AbstractCompiledType<z.ZodRecord<K, V>> {
|
|
371
|
+
compileType(): ts.TypeNode;
|
|
372
|
+
compileParser(ctx: IGeneratorContext, path: Path): Generator<ts.Statement>;
|
|
373
|
+
}
|
|
374
|
+
|
|
375
|
+
declare class ZcSet<TZod extends z.ZodType> extends AbstractCompiledType<z.ZodSet<TZod>> {
|
|
376
|
+
compileType(): ts.TypeNode;
|
|
377
|
+
compileParser(ctx: IGeneratorContext, path: Path): Generator<ts.Statement>;
|
|
378
|
+
}
|
|
379
|
+
|
|
380
|
+
declare class ZcString extends AbstractCompiledType<z.ZodString> {
|
|
381
|
+
compileType(): ts.TypeNode;
|
|
382
|
+
compileParser(ctx: IGeneratorContext, path: Path): Iterable<ts.Statement>;
|
|
383
|
+
private static _basicCheck;
|
|
384
|
+
}
|
|
385
|
+
|
|
386
|
+
declare class ZcSymbol extends AbstractCompiledType<z.ZodSymbol> {
|
|
387
|
+
compileType(): ts.TypeNode;
|
|
388
|
+
compileParser(ctx: IGeneratorContext, path: Path): Iterable<ts.Statement>;
|
|
389
|
+
}
|
|
390
|
+
|
|
391
|
+
declare class ZcTuple<T extends [z.ZodTypeAny, ...z.ZodTypeAny[]] | [], TRest extends z.ZodTypeAny | null = null> extends AbstractCompiledType<z.ZodTuple<T, TRest>> {
|
|
392
|
+
compileType(): ts.TypeNode;
|
|
393
|
+
compileParser(ctx: IGeneratorContext, path: Path): Generator<ts.Statement>;
|
|
394
|
+
}
|
|
395
|
+
|
|
396
|
+
declare class ZcUndefined extends AbstractCompiledType<z.ZodUndefined> {
|
|
397
|
+
compileType(): ts.TypeNode;
|
|
398
|
+
compileParser(ctx: IGeneratorContext, path: Path): Iterable<ts.Statement>;
|
|
399
|
+
}
|
|
400
|
+
|
|
401
|
+
declare class ZcUnion<T extends z.ZodUnionOptions> extends AbstractCompiledType<z.ZodUnion<T>> {
|
|
402
|
+
compileType(): ts.TypeNode;
|
|
403
|
+
compileParser(ctx: IGeneratorContext, path: Path): Generator<ts.Statement>;
|
|
404
|
+
}
|
|
405
|
+
|
|
406
|
+
declare class ZcUnknown extends AbstractCompiledType<z.ZodUnknown> {
|
|
407
|
+
compileType(): ts.TypeNode;
|
|
408
|
+
compileParser(ctx: IGeneratorContext, path: Path): Iterable<ts.Statement>;
|
|
409
|
+
}
|
|
410
|
+
|
|
411
|
+
declare class ZcVoid extends AbstractCompiledType<z.ZodVoid> {
|
|
412
|
+
compileType(): ts.TypeNode;
|
|
413
|
+
compileParser(ctx: IGeneratorContext, path: Path): Iterable<ts.Statement>;
|
|
414
|
+
}
|
|
415
|
+
|
|
416
|
+
interface CompileOptions<Standalone extends boolean = false> {
|
|
417
|
+
/**
|
|
418
|
+
* Outputs a **standalone** parser.
|
|
419
|
+
*
|
|
420
|
+
* The compiler part of `zod-compiler` depends on Zod and TypeScript -- the latter being a very large dependency. If
|
|
421
|
+
* you'd wish to deploy a compiled Zod parser to i.e. a different repository separate from your schema definition, or
|
|
422
|
+
* if you just want a dependency-free parser, you can enable this option to instead output a *standalone parser*.
|
|
423
|
+
*
|
|
424
|
+
* {@linkcode compile compile()} will then return a {@linkcode StandaloneOutput} with the parser's source code as a function.
|
|
425
|
+
* This source code can be placed in a module, imported, and the function passed to {@linkcode standalone standalone}
|
|
426
|
+
* (in the `zod-compiler/standalone` module) to create the exact same parser `compile()` normally would - now without
|
|
427
|
+
* any dependencies!
|
|
428
|
+
*/
|
|
429
|
+
standalone?: Standalone;
|
|
430
|
+
/**
|
|
431
|
+
* Controls how values are inlined in the generated code. For more information, see {@linkcode InliningMode}.
|
|
432
|
+
*
|
|
433
|
+
* For in-source usage of `zod-compiler`, this need not be changed from `Default`. However, for
|
|
434
|
+
* {@link CompileOptions.standalone standalone}-compiled schemas, you'll probably want to use {@linkcode InliningMode.Aggressive Aggressive}
|
|
435
|
+
* for easier deployment.
|
|
436
|
+
*
|
|
437
|
+
* @default InliningMode.Default
|
|
438
|
+
*/
|
|
439
|
+
inlining?: InliningMode;
|
|
440
|
+
}
|
|
441
|
+
/** The output of a {@link CompileOptions.standalone standalone} compilation. */
|
|
442
|
+
interface StandaloneOutput {
|
|
443
|
+
/**
|
|
444
|
+
* The source code of the compiled parser function.
|
|
445
|
+
*
|
|
446
|
+
* This is in the form:
|
|
447
|
+
* ```ts ignore
|
|
448
|
+
* function (input, ctx) {
|
|
449
|
+
* ...
|
|
450
|
+
* }
|
|
451
|
+
* ```
|
|
452
|
+
*/
|
|
453
|
+
source: string;
|
|
454
|
+
/**
|
|
455
|
+
* The list of **dependency** values this parser requires.
|
|
456
|
+
*
|
|
457
|
+
* When the {@link InliningMode inlining mode} is not set to {@linkcode InliningMode.Aggressive Aggressive}, object
|
|
458
|
+
* values defined in `z.literal()` or via `.default()` or `.catch()` are referenced via a **dependency**; these dependencies
|
|
459
|
+
* must then be passed to {@linkcode standalone standalone()}. See {@linkcode InliningMode} for more information.
|
|
460
|
+
*
|
|
461
|
+
* Compiling with `inlining: InliningMode.Aggressive` outputs a parser with no dependencies; object values will be
|
|
462
|
+
* serialized directly in source code.
|
|
463
|
+
*/
|
|
464
|
+
dependencies: readonly any[];
|
|
465
|
+
/** `true` if this parser has any dependencies. */
|
|
466
|
+
readonly hasDependencies: boolean;
|
|
467
|
+
}
|
|
468
|
+
/**
|
|
469
|
+
* Compile a Zod schema for use out-of-source.
|
|
470
|
+
*
|
|
471
|
+
* This outputs a {@linkcode StandaloneOutput} which can be used to create a regular {@linkcode CompiledParser} via
|
|
472
|
+
* {@linkcode standalone standalone()}:
|
|
473
|
+
* ```ts
|
|
474
|
+
* import z from 'zod';
|
|
475
|
+
*
|
|
476
|
+
* const schema = z.string();
|
|
477
|
+
*
|
|
478
|
+
* const output = compile(schema, { standalone: true });
|
|
479
|
+
* console.log(output.source); // function (input, ctx) { ... }
|
|
480
|
+
*
|
|
481
|
+
* // put that source in a module and then `import` it...
|
|
482
|
+
* const parserFn = Function(`return ${output.source}`)();
|
|
483
|
+
*
|
|
484
|
+
* import standalone from 'zod-compiler/standalone';
|
|
485
|
+
* const parser = standalone(parserFn);
|
|
486
|
+
*
|
|
487
|
+
* console.log(parser.safeParse('Hello, world!')); // { success: true, data: ... }
|
|
488
|
+
* ```
|
|
489
|
+
*/
|
|
490
|
+
declare function compile<TZod extends z.ZodTypeAny>(schema: TZod, options: CompileOptions<true>): StandaloneOutput;
|
|
491
|
+
/**
|
|
492
|
+
* Compile a Zod schema to an accelerated parser.
|
|
493
|
+
* ```ts
|
|
494
|
+
* import z from 'zod';
|
|
495
|
+
*
|
|
496
|
+
* const schema = z.string();
|
|
497
|
+
*
|
|
498
|
+
* const fastSchema = compile(schema);
|
|
499
|
+
* console.log(fastSchema.safeParse('Hello, world!')); // { success: true, data: ... }
|
|
500
|
+
* ```
|
|
501
|
+
*/
|
|
502
|
+
declare function compile<TZod extends z.ZodTypeAny>(schema: TZod, options?: CompileOptions<false>): CompiledParser<TZod['_output']>;
|
|
503
|
+
declare function compile<TZod extends z.ZodTypeAny>(schema: TZod, options?: CompileOptions<boolean>): StandaloneOutput | CompiledParser<TZod['_output']>;
|
|
504
|
+
interface TypesOptions {
|
|
505
|
+
/**
|
|
506
|
+
* Output the schema as a type alias in the form of `export type Schema = ...` (where `Schema` is configurable via
|
|
507
|
+
* {@linkcode TypesOptions.schemaName schemaName}).
|
|
508
|
+
*
|
|
509
|
+
* Setting to `false` will return the type definition directly:
|
|
510
|
+
* ```
|
|
511
|
+
* import z from 'zod';
|
|
512
|
+
* import zc from 'zod-compiler';
|
|
513
|
+
*
|
|
514
|
+
* const schema = z.string();
|
|
515
|
+
*
|
|
516
|
+
* console.log(zc.types(schema, { asExport: true }));
|
|
517
|
+
* // export type Schema = string;
|
|
518
|
+
* console.log(zc.types(schema, { asExport: false }));
|
|
519
|
+
* // string
|
|
520
|
+
* ```
|
|
521
|
+
*
|
|
522
|
+
* @default true
|
|
523
|
+
*/
|
|
524
|
+
asExport?: boolean;
|
|
525
|
+
/**
|
|
526
|
+
* The name of the generated schema when {@linkcode TypesOptions.asExport asExport} is `true` (the default).
|
|
527
|
+
*
|
|
528
|
+
* ```
|
|
529
|
+
* import z from 'zod';
|
|
530
|
+
* import zc from 'zod-compiler';
|
|
531
|
+
*
|
|
532
|
+
* const schema = z.string();
|
|
533
|
+
*
|
|
534
|
+
* console.log(zc.types(schema));
|
|
535
|
+
* // export type Schema = string;
|
|
536
|
+
* console.log(zc.types(schema, { schemaName: 'MyStructure' }));
|
|
537
|
+
* // export type MyStructure = string;
|
|
538
|
+
* ```
|
|
539
|
+
*
|
|
540
|
+
* @default "Schema"
|
|
541
|
+
*/
|
|
542
|
+
schemaName?: string;
|
|
543
|
+
}
|
|
544
|
+
/**
|
|
545
|
+
* Exports the `schema` to a TypeScript type definition.
|
|
546
|
+
*
|
|
547
|
+
* ```ts
|
|
548
|
+
* import z from 'zod';
|
|
549
|
+
* import zc from 'zod-compiler';
|
|
550
|
+
*
|
|
551
|
+
* const schema = z.string();
|
|
552
|
+
*
|
|
553
|
+
* console.log(zc.types(schema));
|
|
554
|
+
* // export type Schema = string;
|
|
555
|
+
* ```
|
|
556
|
+
*/
|
|
557
|
+
declare function types<TZod extends z.ZodTypeAny>(schema: TZod, options?: TypesOptions): string;
|
|
558
|
+
|
|
559
|
+
type zc_AbstractCompiledType<TZod extends z.ZodType> = AbstractCompiledType<TZod>;
|
|
560
|
+
declare const zc_AbstractCompiledType: typeof AbstractCompiledType;
|
|
561
|
+
type zc_CompileOptions<Standalone extends boolean = false> = CompileOptions<Standalone>;
|
|
562
|
+
declare const zc_CompiledParser: typeof CompiledParser;
|
|
563
|
+
type zc_DenormalizedError = DenormalizedError;
|
|
564
|
+
type zc_ErrorMapCtx = ErrorMapCtx;
|
|
565
|
+
type zc_InliningMode = InliningMode;
|
|
566
|
+
declare const zc_InliningMode: typeof InliningMode;
|
|
567
|
+
type zc_IssueData = IssueData;
|
|
568
|
+
type zc_Primitive = Primitive;
|
|
569
|
+
type zc_Scalars = Scalars;
|
|
570
|
+
type zc_StandaloneOutput = StandaloneOutput;
|
|
571
|
+
type zc_StringValidation = StringValidation;
|
|
572
|
+
type zc_TypesOptions = TypesOptions;
|
|
573
|
+
type zc_ZcAny = ZcAny;
|
|
574
|
+
declare const zc_ZcAny: typeof ZcAny;
|
|
575
|
+
type zc_ZcArray<TZod extends z.ZodType> = ZcArray<TZod>;
|
|
576
|
+
declare const zc_ZcArray: typeof ZcArray;
|
|
577
|
+
type zc_ZcBigInt = ZcBigInt;
|
|
578
|
+
declare const zc_ZcBigInt: typeof ZcBigInt;
|
|
579
|
+
type zc_ZcBoolean = ZcBoolean;
|
|
580
|
+
declare const zc_ZcBoolean: typeof ZcBoolean;
|
|
581
|
+
type zc_ZcBranded<TZod extends z.ZodTypeAny, B extends string | number | symbol> = ZcBranded<TZod, B>;
|
|
582
|
+
declare const zc_ZcBranded: typeof ZcBranded;
|
|
583
|
+
type zc_ZcCatch<TZod extends z.ZodType> = ZcCatch<TZod>;
|
|
584
|
+
declare const zc_ZcCatch: typeof ZcCatch;
|
|
585
|
+
type zc_ZcCustomIssue = ZcCustomIssue;
|
|
586
|
+
type zc_ZcDate = ZcDate;
|
|
587
|
+
declare const zc_ZcDate: typeof ZcDate;
|
|
588
|
+
type zc_ZcDefault<TZod extends z.ZodType> = ZcDefault<TZod>;
|
|
589
|
+
declare const zc_ZcDefault: typeof ZcDefault;
|
|
590
|
+
type zc_ZcDiscriminatedUnion<TDiscriminator extends string, TOptions extends readonly z.ZodDiscriminatedUnionOption<TDiscriminator>[]> = ZcDiscriminatedUnion<TDiscriminator, TOptions>;
|
|
591
|
+
declare const zc_ZcDiscriminatedUnion: typeof ZcDiscriminatedUnion;
|
|
592
|
+
type zc_ZcEnum<T extends [string, ...string[]]> = ZcEnum<T>;
|
|
593
|
+
declare const zc_ZcEnum: typeof ZcEnum;
|
|
594
|
+
type zc_ZcError<T = any> = ZcError<T>;
|
|
595
|
+
declare const zc_ZcError: typeof ZcError;
|
|
596
|
+
type zc_ZcErrorMap = ZcErrorMap;
|
|
597
|
+
type zc_ZcFormattedError<T, U = string> = ZcFormattedError<T, U>;
|
|
598
|
+
type zc_ZcIntersection<T extends z.ZodTypeAny, U extends z.ZodTypeAny> = ZcIntersection<T, U>;
|
|
599
|
+
declare const zc_ZcIntersection: typeof ZcIntersection;
|
|
600
|
+
type zc_ZcInvalidArgumentsIssue = ZcInvalidArgumentsIssue;
|
|
601
|
+
type zc_ZcInvalidDateIssue = ZcInvalidDateIssue;
|
|
602
|
+
type zc_ZcInvalidEnumValueIssue = ZcInvalidEnumValueIssue;
|
|
603
|
+
type zc_ZcInvalidIntersectionTypesIssue = ZcInvalidIntersectionTypesIssue;
|
|
604
|
+
type zc_ZcInvalidLiteralIssue = ZcInvalidLiteralIssue;
|
|
605
|
+
type zc_ZcInvalidReturnTypeIssue = ZcInvalidReturnTypeIssue;
|
|
606
|
+
type zc_ZcInvalidStringIssue = ZcInvalidStringIssue;
|
|
607
|
+
type zc_ZcInvalidTypeIssue = ZcInvalidTypeIssue;
|
|
608
|
+
type zc_ZcInvalidUnionDiscriminatorIssue = ZcInvalidUnionDiscriminatorIssue;
|
|
609
|
+
type zc_ZcInvalidUnionIssue = ZcInvalidUnionIssue;
|
|
610
|
+
type zc_ZcIssue = ZcIssue;
|
|
611
|
+
type zc_ZcIssueBase = ZcIssueBase;
|
|
612
|
+
type zc_ZcIssueCode = ZcIssueCode;
|
|
613
|
+
declare const zc_ZcIssueCode: typeof ZcIssueCode;
|
|
614
|
+
type zc_ZcIssueOptionalMessage = ZcIssueOptionalMessage;
|
|
615
|
+
type zc_ZcLiteral<T> = ZcLiteral<T>;
|
|
616
|
+
declare const zc_ZcLiteral: typeof ZcLiteral;
|
|
617
|
+
type zc_ZcMap<K extends z.ZodTypeAny, V extends z.ZodTypeAny> = ZcMap<K, V>;
|
|
618
|
+
declare const zc_ZcMap: typeof ZcMap;
|
|
619
|
+
type zc_ZcNaN = ZcNaN;
|
|
620
|
+
declare const zc_ZcNaN: typeof ZcNaN;
|
|
621
|
+
type zc_ZcNativeEnum<T extends z.EnumLike> = ZcNativeEnum<T>;
|
|
622
|
+
declare const zc_ZcNativeEnum: typeof ZcNativeEnum;
|
|
623
|
+
type zc_ZcNever = ZcNever;
|
|
624
|
+
declare const zc_ZcNever: typeof ZcNever;
|
|
625
|
+
type zc_ZcNotFiniteIssue = ZcNotFiniteIssue;
|
|
626
|
+
type zc_ZcNotMultipleOfIssue = ZcNotMultipleOfIssue;
|
|
627
|
+
type zc_ZcNull = ZcNull;
|
|
628
|
+
declare const zc_ZcNull: typeof ZcNull;
|
|
629
|
+
type zc_ZcNullable<TZod extends z.ZodType> = ZcNullable<TZod>;
|
|
630
|
+
declare const zc_ZcNullable: typeof ZcNullable;
|
|
631
|
+
type zc_ZcNumber = ZcNumber;
|
|
632
|
+
declare const zc_ZcNumber: typeof ZcNumber;
|
|
633
|
+
type zc_ZcObject<TZod extends z.ZodRawShape> = ZcObject<TZod>;
|
|
634
|
+
declare const zc_ZcObject: typeof ZcObject;
|
|
635
|
+
type zc_ZcOptional<TZod extends z.ZodType> = ZcOptional<TZod>;
|
|
636
|
+
declare const zc_ZcOptional: typeof ZcOptional;
|
|
637
|
+
type zc_ZcReadonly<TZod extends z.ZodTypeAny> = ZcReadonly<TZod>;
|
|
638
|
+
declare const zc_ZcReadonly: typeof ZcReadonly;
|
|
639
|
+
type zc_ZcRecord<K extends z.KeySchema, V extends z.ZodTypeAny> = ZcRecord<K, V>;
|
|
640
|
+
declare const zc_ZcRecord: typeof ZcRecord;
|
|
641
|
+
type zc_ZcSet<TZod extends z.ZodType> = ZcSet<TZod>;
|
|
642
|
+
declare const zc_ZcSet: typeof ZcSet;
|
|
643
|
+
type zc_ZcString = ZcString;
|
|
644
|
+
declare const zc_ZcString: typeof ZcString;
|
|
645
|
+
type zc_ZcSymbol = ZcSymbol;
|
|
646
|
+
declare const zc_ZcSymbol: typeof ZcSymbol;
|
|
647
|
+
type zc_ZcTooBigIssue = ZcTooBigIssue;
|
|
648
|
+
type zc_ZcTooSmallIssue = ZcTooSmallIssue;
|
|
649
|
+
type zc_ZcTuple<T extends [z.ZodTypeAny, ...z.ZodTypeAny[]] | [], TRest extends z.ZodTypeAny | null = null> = ZcTuple<T, TRest>;
|
|
650
|
+
declare const zc_ZcTuple: typeof ZcTuple;
|
|
651
|
+
type zc_ZcUndefined = ZcUndefined;
|
|
652
|
+
declare const zc_ZcUndefined: typeof ZcUndefined;
|
|
653
|
+
type zc_ZcUnion<T extends z.ZodUnionOptions> = ZcUnion<T>;
|
|
654
|
+
declare const zc_ZcUnion: typeof ZcUnion;
|
|
655
|
+
type zc_ZcUnknown = ZcUnknown;
|
|
656
|
+
declare const zc_ZcUnknown: typeof ZcUnknown;
|
|
657
|
+
type zc_ZcUnrecognizedKeysIssue = ZcUnrecognizedKeysIssue;
|
|
658
|
+
type zc_ZcVoid = ZcVoid;
|
|
659
|
+
declare const zc_ZcVoid: typeof ZcVoid;
|
|
660
|
+
declare const zc_compilable: typeof compilable;
|
|
661
|
+
declare const zc_compile: typeof compile;
|
|
662
|
+
type zc_typeToFlattenedError<T, U = string> = typeToFlattenedError<T, U>;
|
|
663
|
+
declare const zc_types: typeof types;
|
|
664
|
+
declare namespace zc {
|
|
665
|
+
export { zc_AbstractCompiledType as AbstractCompiledType, zc_CompiledParser as CompiledParser, zc_InliningMode as InliningMode, zc_ZcAny as ZcAny, zc_ZcArray as ZcArray, zc_ZcBigInt as ZcBigInt, zc_ZcBoolean as ZcBoolean, zc_ZcBranded as ZcBranded, zc_ZcCatch as ZcCatch, zc_ZcDate as ZcDate, zc_ZcDefault as ZcDefault, zc_ZcDiscriminatedUnion as ZcDiscriminatedUnion, zc_ZcEnum as ZcEnum, zc_ZcError as ZcError, zc_ZcIntersection as ZcIntersection, zc_ZcIssueCode as ZcIssueCode, zc_ZcLiteral as ZcLiteral, zc_ZcMap as ZcMap, zc_ZcNaN as ZcNaN, zc_ZcNativeEnum as ZcNativeEnum, zc_ZcNever as ZcNever, zc_ZcNull as ZcNull, zc_ZcNullable as ZcNullable, zc_ZcNumber as ZcNumber, zc_ZcObject as ZcObject, zc_ZcOptional as ZcOptional, zc_ZcReadonly as ZcReadonly, zc_ZcRecord as ZcRecord, zc_ZcSet as ZcSet, zc_ZcString as ZcString, zc_ZcSymbol as ZcSymbol, zc_ZcTuple as ZcTuple, zc_ZcUndefined as ZcUndefined, zc_ZcUnion as ZcUnion, zc_ZcUnknown as ZcUnknown, zc_ZcVoid as ZcVoid, zc_compilable as compilable, zc_compile as compile, zc_types as types };
|
|
666
|
+
export type { zc_CompileOptions as CompileOptions, zc_DenormalizedError as DenormalizedError, zc_ErrorMapCtx as ErrorMapCtx, zc_IssueData as IssueData, zc_Primitive as Primitive, zc_Scalars as Scalars, zc_StandaloneOutput as StandaloneOutput, zc_StringValidation as StringValidation, zc_TypesOptions as TypesOptions, zc_ZcCustomIssue as ZcCustomIssue, zc_ZcErrorMap as ZcErrorMap, zc_ZcFormattedError as ZcFormattedError, zc_ZcInvalidArgumentsIssue as ZcInvalidArgumentsIssue, zc_ZcInvalidDateIssue as ZcInvalidDateIssue, zc_ZcInvalidEnumValueIssue as ZcInvalidEnumValueIssue, zc_ZcInvalidIntersectionTypesIssue as ZcInvalidIntersectionTypesIssue, zc_ZcInvalidLiteralIssue as ZcInvalidLiteralIssue, zc_ZcInvalidReturnTypeIssue as ZcInvalidReturnTypeIssue, zc_ZcInvalidStringIssue as ZcInvalidStringIssue, zc_ZcInvalidTypeIssue as ZcInvalidTypeIssue, zc_ZcInvalidUnionDiscriminatorIssue as ZcInvalidUnionDiscriminatorIssue, zc_ZcInvalidUnionIssue as ZcInvalidUnionIssue, zc_ZcIssue as ZcIssue, zc_ZcIssueBase as ZcIssueBase, zc_ZcIssueOptionalMessage as ZcIssueOptionalMessage, zc_ZcNotFiniteIssue as ZcNotFiniteIssue, zc_ZcNotMultipleOfIssue as ZcNotMultipleOfIssue, zc_ZcTooBigIssue as ZcTooBigIssue, zc_ZcTooSmallIssue as ZcTooSmallIssue, zc_ZcUnrecognizedKeysIssue as ZcUnrecognizedKeysIssue, zc_typeToFlattenedError as typeToFlattenedError };
|
|
667
|
+
}
|
|
668
|
+
|
|
669
|
+
export { AbstractCompiledType, InliningMode, ZcAny, ZcArray, ZcBigInt, ZcBoolean, ZcBranded, ZcCatch, ZcDate, ZcDefault, ZcDiscriminatedUnion, ZcEnum, ZcError, ZcIntersection, ZcIssueCode, ZcLiteral, ZcMap, ZcNaN, ZcNativeEnum, ZcNever, ZcNull, ZcNullable, ZcNumber, ZcObject, ZcOptional, ZcReadonly, ZcRecord, ZcSet, ZcString, ZcSymbol, ZcTuple, ZcUndefined, ZcUnion, ZcUnknown, ZcVoid, compilable, compile, zc as default, types };
|
|
670
|
+
export type { CompileOptions, DenormalizedError, ErrorMapCtx, IssueData, Primitive, Scalars, StandaloneOutput, StringValidation, TypesOptions, ZcCustomIssue, ZcErrorMap, ZcFormattedError, ZcInvalidArgumentsIssue, ZcInvalidDateIssue, ZcInvalidEnumValueIssue, ZcInvalidIntersectionTypesIssue, ZcInvalidLiteralIssue, ZcInvalidReturnTypeIssue, ZcInvalidStringIssue, ZcInvalidTypeIssue, ZcInvalidUnionDiscriminatorIssue, ZcInvalidUnionIssue, ZcIssue, ZcIssueBase, ZcIssueOptionalMessage, ZcNotFiniteIssue, ZcNotMultipleOfIssue, ZcTooBigIssue, ZcTooSmallIssue, ZcUnrecognizedKeysIssue, typeToFlattenedError };
|