zod 4.1.0-canary.20250723T221600 → 4.1.0-canary.20250724T211341

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 (60) hide show
  1. package/package.json +1 -1
  2. package/src/v3/types.ts +3 -1
  3. package/src/v4/classic/errors.ts +9 -2
  4. package/src/v4/classic/schemas.ts +10 -7
  5. package/src/v4/classic/tests/error-utils.test.ts +43 -0
  6. package/src/v4/classic/tests/file.test.ts +0 -1
  7. package/src/v4/classic/tests/literal.test.ts +25 -0
  8. package/src/v4/classic/tests/partial.test.ts +193 -0
  9. package/src/v4/classic/tests/pickomit.test.ts +5 -5
  10. package/src/v4/classic/tests/preprocess.test.ts +4 -15
  11. package/src/v4/classic/tests/record.test.ts +15 -1
  12. package/src/v4/classic/tests/recursive-types.test.ts +67 -0
  13. package/src/v4/classic/tests/string.test.ts +77 -0
  14. package/src/v4/classic/tests/template-literal.test.ts +3 -0
  15. package/src/v4/classic/tests/to-json-schema.test.ts +1 -0
  16. package/src/v4/classic/tests/transform.test.ts +104 -0
  17. package/src/v4/classic/tests/union.test.ts +90 -3
  18. package/src/v4/core/checks.ts +2 -2
  19. package/src/v4/core/errors.ts +8 -15
  20. package/src/v4/core/registries.ts +3 -2
  21. package/src/v4/core/schemas.ts +93 -95
  22. package/src/v4/core/tests/extend.test.ts +18 -0
  23. package/src/v4/core/to-json-schema.ts +1 -0
  24. package/src/v4/core/util.ts +135 -98
  25. package/src/v4/core/versions.ts +1 -1
  26. package/src/v4/mini/schemas.ts +3 -1
  27. package/v3/types.cjs +2 -0
  28. package/v3/types.d.cts +4 -1
  29. package/v3/types.d.ts +4 -1
  30. package/v3/types.js +2 -0
  31. package/v4/classic/errors.cjs +9 -2
  32. package/v4/classic/errors.js +9 -2
  33. package/v4/classic/schemas.cjs +5 -3
  34. package/v4/classic/schemas.d.cts +2 -1
  35. package/v4/classic/schemas.d.ts +2 -1
  36. package/v4/classic/schemas.js +5 -3
  37. package/v4/core/checks.d.cts +2 -2
  38. package/v4/core/checks.d.ts +2 -2
  39. package/v4/core/errors.cjs +4 -9
  40. package/v4/core/errors.d.cts +4 -6
  41. package/v4/core/errors.d.ts +4 -6
  42. package/v4/core/errors.js +4 -9
  43. package/v4/core/registries.cjs +2 -1
  44. package/v4/core/registries.d.cts +1 -1
  45. package/v4/core/registries.d.ts +1 -1
  46. package/v4/core/registries.js +2 -1
  47. package/v4/core/schemas.cjs +51 -88
  48. package/v4/core/schemas.d.cts +8 -3
  49. package/v4/core/schemas.d.ts +8 -3
  50. package/v4/core/schemas.js +51 -88
  51. package/v4/core/to-json-schema.cjs +1 -0
  52. package/v4/core/to-json-schema.js +1 -0
  53. package/v4/core/util.cjs +123 -97
  54. package/v4/core/util.d.cts +2 -0
  55. package/v4/core/util.d.ts +2 -0
  56. package/v4/core/util.js +121 -97
  57. package/v4/core/versions.cjs +1 -1
  58. package/v4/core/versions.js +1 -1
  59. package/v4/mini/schemas.cjs +3 -1
  60. package/v4/mini/schemas.js +3 -1
@@ -41,13 +41,7 @@ const initializer = (inst, def) => {
41
41
  value: def,
42
42
  enumerable: false,
43
43
  });
44
- Object.defineProperty(inst, "message", {
45
- get() {
46
- return JSON.stringify(def, util.jsonStringifyReplacer, 2);
47
- },
48
- enumerable: true,
49
- // configurable: false,
50
- });
44
+ inst.message = JSON.stringify(def, util.jsonStringifyReplacer, 2);
51
45
  Object.defineProperty(inst, "toString", {
52
46
  value: () => inst.message,
53
47
  enumerable: false,
@@ -194,8 +188,9 @@ function treeifyError(error, _mapper) {
194
188
  * ✖ Invalid input: expected number
195
189
  * ```
196
190
  */
197
- function toDotPath(path) {
191
+ function toDotPath(_path) {
198
192
  const segs = [];
193
+ const path = _path.map((seg) => (typeof seg === "object" ? seg.key : seg));
199
194
  for (const seg of path) {
200
195
  if (typeof seg === "number")
201
196
  segs.push(`[${seg}]`);
@@ -214,7 +209,7 @@ function toDotPath(path) {
214
209
  function prettifyError(error) {
215
210
  const lines = [];
216
211
  // sort by path length
217
- const issues = [...error.issues].sort((a, b) => a.path.length - b.path.length);
212
+ const issues = [...error.issues].sort((a, b) => (a.path ?? []).length - (b.path ?? []).length);
218
213
  // Process each issue
219
214
  for (const issue of issues) {
220
215
  lines.push(`✖ ${issue.message}`);
@@ -1,6 +1,7 @@
1
1
  import type { $ZodCheck, $ZodStringFormats } from "./checks.cjs";
2
2
  import { $constructor } from "./core.cjs";
3
3
  import type { $ZodType } from "./schemas.cjs";
4
+ import type { StandardSchemaV1 } from "./standard-schema.cjs";
4
5
  import * as util from "./util.cjs";
5
6
  export interface $ZodIssueBase {
6
7
  readonly code?: string;
@@ -107,7 +108,7 @@ type RawIssue<T extends $ZodIssueBase> = util.Flatten<util.MakePartial<T, "messa
107
108
  readonly input?: unknown;
108
109
  /** The schema or check that originated this issue. */
109
110
  readonly inst?: $ZodType | $ZodCheck;
110
- /** @deprecated Internal use only. If `true`, Zod will continue executing validation despite this issue. */
111
+ /** If `true`, Zod will continue executing validation despite this issue. */
111
112
  readonly continue?: boolean | undefined;
112
113
  } & Record<string, any>>;
113
114
  export interface $ZodErrorMap<T extends $ZodIssueBase = $ZodIssue> {
@@ -202,9 +203,6 @@ export declare function treeifyError<T, U>(error: $ZodError<T>, mapper?: (issue:
202
203
  * ✖ Invalid input: expected number
203
204
  * ```
204
205
  */
205
- export declare function toDotPath(path: (string | number | symbol)[]): string;
206
- interface BaseError {
207
- issues: $ZodIssueBase[];
208
- }
209
- export declare function prettifyError(error: BaseError): string;
206
+ export declare function toDotPath(_path: readonly (string | number | symbol | StandardSchemaV1.PathSegment)[]): string;
207
+ export declare function prettifyError(error: StandardSchemaV1.FailureResult): string;
210
208
  export {};
@@ -1,6 +1,7 @@
1
1
  import type { $ZodCheck, $ZodStringFormats } from "./checks.js";
2
2
  import { $constructor } from "./core.js";
3
3
  import type { $ZodType } from "./schemas.js";
4
+ import type { StandardSchemaV1 } from "./standard-schema.js";
4
5
  import * as util from "./util.js";
5
6
  export interface $ZodIssueBase {
6
7
  readonly code?: string;
@@ -107,7 +108,7 @@ type RawIssue<T extends $ZodIssueBase> = util.Flatten<util.MakePartial<T, "messa
107
108
  readonly input?: unknown;
108
109
  /** The schema or check that originated this issue. */
109
110
  readonly inst?: $ZodType | $ZodCheck;
110
- /** @deprecated Internal use only. If `true`, Zod will continue executing validation despite this issue. */
111
+ /** If `true`, Zod will continue executing validation despite this issue. */
111
112
  readonly continue?: boolean | undefined;
112
113
  } & Record<string, any>>;
113
114
  export interface $ZodErrorMap<T extends $ZodIssueBase = $ZodIssue> {
@@ -202,9 +203,6 @@ export declare function treeifyError<T, U>(error: $ZodError<T>, mapper?: (issue:
202
203
  * ✖ Invalid input: expected number
203
204
  * ```
204
205
  */
205
- export declare function toDotPath(path: (string | number | symbol)[]): string;
206
- interface BaseError {
207
- issues: $ZodIssueBase[];
208
- }
209
- export declare function prettifyError(error: BaseError): string;
206
+ export declare function toDotPath(_path: readonly (string | number | symbol | StandardSchemaV1.PathSegment)[]): string;
207
+ export declare function prettifyError(error: StandardSchemaV1.FailureResult): string;
210
208
  export {};
package/v4/core/errors.js CHANGED
@@ -10,13 +10,7 @@ const initializer = (inst, def) => {
10
10
  value: def,
11
11
  enumerable: false,
12
12
  });
13
- Object.defineProperty(inst, "message", {
14
- get() {
15
- return JSON.stringify(def, util.jsonStringifyReplacer, 2);
16
- },
17
- enumerable: true,
18
- // configurable: false,
19
- });
13
+ inst.message = JSON.stringify(def, util.jsonStringifyReplacer, 2);
20
14
  Object.defineProperty(inst, "toString", {
21
15
  value: () => inst.message,
22
16
  enumerable: false,
@@ -163,8 +157,9 @@ export function treeifyError(error, _mapper) {
163
157
  * ✖ Invalid input: expected number
164
158
  * ```
165
159
  */
166
- export function toDotPath(path) {
160
+ export function toDotPath(_path) {
167
161
  const segs = [];
162
+ const path = _path.map((seg) => (typeof seg === "object" ? seg.key : seg));
168
163
  for (const seg of path) {
169
164
  if (typeof seg === "number")
170
165
  segs.push(`[${seg}]`);
@@ -183,7 +178,7 @@ export function toDotPath(path) {
183
178
  export function prettifyError(error) {
184
179
  const lines = [];
185
180
  // sort by path length
186
- const issues = [...error.issues].sort((a, b) => a.path.length - b.path.length);
181
+ const issues = [...error.issues].sort((a, b) => (a.path ?? []).length - (b.path ?? []).length);
187
182
  // Process each issue
188
183
  for (const issue of issues) {
189
184
  lines.push(`✖ ${issue.message}`);
@@ -40,7 +40,8 @@ class $ZodRegistry {
40
40
  if (p) {
41
41
  const pm = { ...(this.get(p) ?? {}) };
42
42
  delete pm.id; // do not inherit id
43
- return { ...pm, ...this._map.get(schema) };
43
+ const f = { ...pm, ...this._map.get(schema) };
44
+ return Object.keys(f).length ? f : undefined;
44
45
  }
45
46
  return this._map.get(schema);
46
47
  }
@@ -9,7 +9,7 @@ export type $replace<Meta, S extends $ZodType> = Meta extends $output ? core.out
9
9
  }) => $replace<R, S> : Meta extends object ? {
10
10
  [K in keyof Meta]: $replace<Meta[K], S>;
11
11
  } : Meta;
12
- type MetadataType = Record<string, unknown> | undefined;
12
+ type MetadataType = object | undefined;
13
13
  export declare class $ZodRegistry<Meta extends MetadataType = MetadataType, Schema extends $ZodType = $ZodType> {
14
14
  _meta: Meta;
15
15
  _schema: Schema;
@@ -9,7 +9,7 @@ export type $replace<Meta, S extends $ZodType> = Meta extends $output ? core.out
9
9
  }) => $replace<R, S> : Meta extends object ? {
10
10
  [K in keyof Meta]: $replace<Meta[K], S>;
11
11
  } : Meta;
12
- type MetadataType = Record<string, unknown> | undefined;
12
+ type MetadataType = object | undefined;
13
13
  export declare class $ZodRegistry<Meta extends MetadataType = MetadataType, Schema extends $ZodType = $ZodType> {
14
14
  _meta: Meta;
15
15
  _schema: Schema;
@@ -36,7 +36,8 @@ export class $ZodRegistry {
36
36
  if (p) {
37
37
  const pm = { ...(this.get(p) ?? {}) };
38
38
  delete pm.id; // do not inherit id
39
- return { ...pm, ...this._map.get(schema) };
39
+ const f = { ...pm, ...this._map.get(schema) };
40
+ return Object.keys(f).length ? f : undefined;
40
41
  }
41
42
  return this._map.get(schema);
42
43
  }
@@ -187,9 +187,10 @@ exports.$ZodURL = core.$constructor("$ZodURL", (inst, def) => {
187
187
  exports.$ZodStringFormat.init(inst, def);
188
188
  inst._zod.check = (payload) => {
189
189
  try {
190
- const orig = payload.value;
191
- const url = new URL(orig);
192
- const href = url.href;
190
+ // Trim whitespace from input
191
+ const trimmed = payload.value.trim();
192
+ // @ts-ignore
193
+ const url = new URL(trimmed);
193
194
  if (def.hostname) {
194
195
  def.hostname.lastIndex = 0;
195
196
  if (!def.hostname.test(url.hostname)) {
@@ -218,12 +219,14 @@ exports.$ZodURL = core.$constructor("$ZodURL", (inst, def) => {
218
219
  });
219
220
  }
220
221
  }
221
- // payload.value = url.href;
222
- if (!orig.endsWith("/") && href.endsWith("/")) {
223
- payload.value = href.slice(0, -1);
222
+ // Set the output value based on normalize flag
223
+ if (def.normalize) {
224
+ // Use normalized URL
225
+ payload.value = url.href;
224
226
  }
225
227
  else {
226
- payload.value = href;
228
+ // Preserve the original input (trimmed)
229
+ payload.value = trimmed;
227
230
  }
228
231
  return;
229
232
  }
@@ -299,6 +302,7 @@ exports.$ZodIPv6 = core.$constructor("$ZodIPv6", (inst, def) => {
299
302
  });
300
303
  inst._zod.check = (payload) => {
301
304
  try {
305
+ // @ts-ignore
302
306
  new URL(`http://[${payload.value}]`);
303
307
  // return;
304
308
  }
@@ -330,6 +334,7 @@ exports.$ZodCIDRv6 = core.$constructor("$ZodCIDRv6", (inst, def) => {
330
334
  throw new Error();
331
335
  if (prefixNum < 0 || prefixNum > 128)
332
336
  throw new Error();
337
+ // @ts-ignore
333
338
  new URL(`http://[${address}]`);
334
339
  }
335
340
  catch {
@@ -350,6 +355,7 @@ function isValidBase64(data) {
350
355
  if (data.length % 4 !== 0)
351
356
  return false;
352
357
  try {
358
+ // @ts-ignore
353
359
  atob(data);
354
360
  return true;
355
361
  }
@@ -414,6 +420,7 @@ function isValidJWT(token, algorithm = null) {
414
420
  const [header] = tokensParts;
415
421
  if (!header)
416
422
  return false;
423
+ // @ts-ignore
417
424
  const parsedHeader = JSON.parse(atob(header));
418
425
  if ("typ" in parsedHeader && parsedHeader?.typ !== "JWT")
419
426
  return false;
@@ -684,36 +691,16 @@ exports.$ZodArray = core.$constructor("$ZodArray", (inst, def) => {
684
691
  return payload; //handleArrayResultsAsync(parseResults, final);
685
692
  };
686
693
  });
687
- function handleObjectResult(result, final, key) {
688
- // if(isOptional)
694
+ function handlePropertyResult(result, final, key, input) {
689
695
  if (result.issues.length) {
690
696
  final.issues.push(...util.prefixIssues(key, result.issues));
691
697
  }
692
- final.value[key] = result.value;
693
- }
694
- function handleOptionalObjectResult(result, final, key, input) {
695
- if (result.issues.length) {
696
- // validation failed against value schema
697
- if (input[key] === undefined) {
698
- // if input was undefined, ignore the error
699
- if (key in input) {
700
- final.value[key] = undefined;
701
- }
702
- else {
703
- final.value[key] = result.value;
704
- }
705
- }
706
- else {
707
- final.issues.push(...util.prefixIssues(key, result.issues));
708
- }
709
- }
710
- else if (result.value === undefined) {
711
- // validation returned `undefined`
712
- if (key in input)
698
+ if (result.value === undefined) {
699
+ if (key in input) {
713
700
  final.value[key] = undefined;
701
+ }
714
702
  }
715
703
  else {
716
- // non-undefined value
717
704
  final.value[key] = result.value;
718
705
  }
719
706
  }
@@ -765,42 +752,25 @@ exports.$ZodObject = core.$constructor("$ZodObject", (inst, def) => {
765
752
  // A: preserve key order {
766
753
  doc.write(`const newResult = {}`);
767
754
  for (const key of normalized.keys) {
768
- if (normalized.optionalKeys.has(key)) {
769
- const id = ids[key];
770
- doc.write(`const ${id} = ${parseStr(key)};`);
771
- const k = util.esc(key);
772
- doc.write(`
755
+ const id = ids[key];
756
+ const k = util.esc(key);
757
+ doc.write(`const ${id} = ${parseStr(key)};`);
758
+ doc.write(`
773
759
  if (${id}.issues.length) {
774
- if (input[${k}] === undefined) {
775
- if (${k} in input) {
776
- newResult[${k}] = undefined;
777
- }
778
- } else {
779
- payload.issues = payload.issues.concat(
780
- ${id}.issues.map((iss) => ({
781
- ...iss,
782
- path: iss.path ? [${k}, ...iss.path] : [${k}],
783
- }))
784
- );
760
+ payload.issues = payload.issues.concat(${id}.issues.map(iss => ({
761
+ ...iss,
762
+ path: iss.path ? [${k}, ...iss.path] : [${k}]
763
+ })));
764
+ }
765
+
766
+ if (${id}.value === undefined) {
767
+ if (${k} in input) {
768
+ newResult[${k}] = undefined;
785
769
  }
786
- } else if (${id}.value === undefined) {
787
- if (${k} in input) newResult[${k}] = undefined;
788
770
  } else {
789
771
  newResult[${k}] = ${id}.value;
790
772
  }
791
- `);
792
- }
793
- else {
794
- const id = ids[key];
795
- // const id = ids[key];
796
- doc.write(`const ${id} = ${parseStr(key)};`);
797
- doc.write(`
798
- if (${id}.issues.length) payload.issues = payload.issues.concat(${id}.issues.map(iss => ({
799
- ...iss,
800
- path: iss.path ? [${util.esc(key)}, ...iss.path] : [${util.esc(key)}]
801
- })));`);
802
- doc.write(`newResult[${util.esc(key)}] = ${id}.value`);
803
- }
773
+ `);
804
774
  }
805
775
  doc.write(`payload.value = newResult;`);
806
776
  doc.write(`return payload;`);
@@ -838,33 +808,16 @@ exports.$ZodObject = core.$constructor("$ZodObject", (inst, def) => {
838
808
  const shape = value.shape;
839
809
  for (const key of value.keys) {
840
810
  const el = shape[key];
841
- // do not add omitted optional keys
842
- // if (!(key in input)) {
843
- // if (optionalKeys.has(key)) continue;
844
- // payload.issues.push({
845
- // code: "invalid_type",
846
- // path: [key],
847
- // expected: "nonoptional",
848
- // note: `Missing required key: "${key}"`,
849
- // input,
850
- // inst,
851
- // });
852
- // }
853
811
  const r = el._zod.run({ value: input[key], issues: [] }, ctx);
854
- const isOptional = el._zod.optin === "optional" && el._zod.optout === "optional";
855
812
  if (r instanceof Promise) {
856
- proms.push(r.then((r) => isOptional ? handleOptionalObjectResult(r, payload, key, input) : handleObjectResult(r, payload, key)));
857
- }
858
- else if (isOptional) {
859
- handleOptionalObjectResult(r, payload, key, input);
813
+ proms.push(r.then((r) => handlePropertyResult(r, payload, key, input)));
860
814
  }
861
815
  else {
862
- handleObjectResult(r, payload, key);
816
+ handlePropertyResult(r, payload, key, input);
863
817
  }
864
818
  }
865
819
  }
866
820
  if (!catchall) {
867
- // return payload;
868
821
  return proms.length ? Promise.all(proms).then(() => payload) : payload;
869
822
  }
870
823
  const unrecognized = [];
@@ -881,10 +834,10 @@ exports.$ZodObject = core.$constructor("$ZodObject", (inst, def) => {
881
834
  }
882
835
  const r = _catchall.run({ value: input[key], issues: [] }, ctx);
883
836
  if (r instanceof Promise) {
884
- proms.push(r.then((r) => handleObjectResult(r, payload, key)));
837
+ proms.push(r.then((r) => handlePropertyResult(r, payload, key, input)));
885
838
  }
886
839
  else {
887
- handleObjectResult(r, payload, key);
840
+ handlePropertyResult(r, payload, key, input);
888
841
  }
889
842
  }
890
843
  if (unrecognized.length) {
@@ -909,6 +862,11 @@ function handleUnionResults(results, final, inst, ctx) {
909
862
  return final;
910
863
  }
911
864
  }
865
+ const nonaborted = results.filter((r) => !util.aborted(r));
866
+ if (nonaborted.length === 1) {
867
+ final.value = nonaborted[0].value;
868
+ return nonaborted[0];
869
+ }
912
870
  final.issues.push({
913
871
  code: "invalid_union",
914
872
  input: final.value,
@@ -1374,14 +1332,15 @@ function handleSetResult(result, final) {
1374
1332
  exports.$ZodEnum = core.$constructor("$ZodEnum", (inst, def) => {
1375
1333
  exports.$ZodType.init(inst, def);
1376
1334
  const values = util.getEnumValues(def.entries);
1377
- inst._zod.values = new Set(values);
1335
+ const valuesSet = new Set(values);
1336
+ inst._zod.values = valuesSet;
1378
1337
  inst._zod.pattern = new RegExp(`^(${values
1379
1338
  .filter((k) => util.propertyKeyTypes.has(typeof k))
1380
1339
  .map((o) => (typeof o === "string" ? util.escapeRegex(o) : o.toString()))
1381
1340
  .join("|")})$`);
1382
1341
  inst._zod.parse = (payload, _ctx) => {
1383
1342
  const input = payload.value;
1384
- if (inst._zod.values.has(input)) {
1343
+ if (valuesSet.has(input)) {
1385
1344
  return payload;
1386
1345
  }
1387
1346
  payload.issues.push({
@@ -1395,9 +1354,12 @@ exports.$ZodEnum = core.$constructor("$ZodEnum", (inst, def) => {
1395
1354
  });
1396
1355
  exports.$ZodLiteral = core.$constructor("$ZodLiteral", (inst, def) => {
1397
1356
  exports.$ZodType.init(inst, def);
1357
+ if (def.values.length === 0) {
1358
+ throw new Error("Cannot create literal schema with no valid values");
1359
+ }
1398
1360
  inst._zod.values = new Set(def.values);
1399
1361
  inst._zod.pattern = new RegExp(`^(${def.values
1400
- .map((o) => (typeof o === "string" ? util.escapeRegex(o) : o ? o.toString() : String(o)))
1362
+ .map((o) => (typeof o === "string" ? util.escapeRegex(o) : o ? util.escapeRegex(o.toString()) : String(o)))
1401
1363
  .join("|")})$`);
1402
1364
  inst._zod.parse = (payload, _ctx) => {
1403
1365
  const input = payload.value;
@@ -1417,6 +1379,7 @@ exports.$ZodFile = core.$constructor("$ZodFile", (inst, def) => {
1417
1379
  exports.$ZodType.init(inst, def);
1418
1380
  inst._zod.parse = (payload, _ctx) => {
1419
1381
  const input = payload.value;
1382
+ // @ts-ignore
1420
1383
  if (input instanceof File)
1421
1384
  return payload;
1422
1385
  payload.issues.push({
@@ -1562,7 +1525,7 @@ exports.$ZodSuccess = core.$constructor("$ZodSuccess", (inst, def) => {
1562
1525
  });
1563
1526
  exports.$ZodCatch = core.$constructor("$ZodCatch", (inst, def) => {
1564
1527
  exports.$ZodType.init(inst, def);
1565
- inst._zod.optin = "optional";
1528
+ util.defineLazy(inst._zod, "optin", () => def.innerType._zod.optin);
1566
1529
  util.defineLazy(inst._zod, "optout", () => def.innerType._zod.optout);
1567
1530
  util.defineLazy(inst._zod, "values", () => def.innerType._zod.values);
1568
1531
  inst._zod.parse = (payload, ctx) => {
@@ -1627,7 +1590,7 @@ exports.$ZodPipe = core.$constructor("$ZodPipe", (inst, def) => {
1627
1590
  };
1628
1591
  });
1629
1592
  function handlePipeResult(left, def, ctx) {
1630
- if (util.aborted(left)) {
1593
+ if (left.issues.length) {
1631
1594
  return left;
1632
1595
  }
1633
1596
  return def.out._zod.run({ value: left.value, issues: left.issues }, ctx);
@@ -54,6 +54,7 @@ export interface _$ZodTypeInternals {
54
54
  * Todo: unions?
55
55
  */
56
56
  values?: util.PrimitiveSet | undefined;
57
+ /** Default value bubbled up from */
57
58
  /** @internal A set of literal discriminators used for the fast path in discriminated unions. */
58
59
  propValues?: util.PropValues | undefined;
59
60
  /** @internal This flag indicates that a schema validation can be represented with a regular expression. Used to determine allowable schemas in z.templateLiteral(). */
@@ -148,6 +149,7 @@ export declare const $ZodEmail: core.$constructor<$ZodEmail>;
148
149
  export interface $ZodURLDef extends $ZodStringFormatDef<"url"> {
149
150
  hostname?: RegExp | undefined;
150
151
  protocol?: RegExp | undefined;
152
+ normalize?: boolean | undefined;
151
153
  }
152
154
  export interface $ZodURLInternals extends $ZodStringFormatInternals<"url"> {
153
155
  def: $ZodURLDef;
@@ -762,9 +764,12 @@ export interface $ZodLiteral<T extends util.Literal = util.Literal> extends $Zod
762
764
  }
763
765
  export declare const $ZodLiteral: core.$constructor<$ZodLiteral>;
764
766
  type _File = typeof globalThis extends {
765
- File: new (...args: any[]) => any;
766
- } ? InstanceType<typeof globalThis.File> : {};
767
- interface File extends _File {
767
+ File: infer F extends new (...args: any[]) => any;
768
+ } ? InstanceType<F> : {};
769
+ /** Do not reference this directly. */
770
+ export interface File extends _File {
771
+ type: string;
772
+ size: number;
768
773
  }
769
774
  export interface $ZodFileDef extends $ZodTypeDef {
770
775
  type: "file";
@@ -54,6 +54,7 @@ export interface _$ZodTypeInternals {
54
54
  * Todo: unions?
55
55
  */
56
56
  values?: util.PrimitiveSet | undefined;
57
+ /** Default value bubbled up from */
57
58
  /** @internal A set of literal discriminators used for the fast path in discriminated unions. */
58
59
  propValues?: util.PropValues | undefined;
59
60
  /** @internal This flag indicates that a schema validation can be represented with a regular expression. Used to determine allowable schemas in z.templateLiteral(). */
@@ -148,6 +149,7 @@ export declare const $ZodEmail: core.$constructor<$ZodEmail>;
148
149
  export interface $ZodURLDef extends $ZodStringFormatDef<"url"> {
149
150
  hostname?: RegExp | undefined;
150
151
  protocol?: RegExp | undefined;
152
+ normalize?: boolean | undefined;
151
153
  }
152
154
  export interface $ZodURLInternals extends $ZodStringFormatInternals<"url"> {
153
155
  def: $ZodURLDef;
@@ -762,9 +764,12 @@ export interface $ZodLiteral<T extends util.Literal = util.Literal> extends $Zod
762
764
  }
763
765
  export declare const $ZodLiteral: core.$constructor<$ZodLiteral>;
764
766
  type _File = typeof globalThis extends {
765
- File: new (...args: any[]) => any;
766
- } ? InstanceType<typeof globalThis.File> : {};
767
- interface File extends _File {
767
+ File: infer F extends new (...args: any[]) => any;
768
+ } ? InstanceType<F> : {};
769
+ /** Do not reference this directly. */
770
+ export interface File extends _File {
771
+ type: string;
772
+ size: number;
768
773
  }
769
774
  export interface $ZodFileDef extends $ZodTypeDef {
770
775
  type: "file";