zod 3.12.1 → 3.13.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.
Files changed (60) hide show
  1. package/README.md +5 -5
  2. package/lib/ZodError.d.ts +0 -1
  3. package/lib/ZodError.js +0 -1
  4. package/lib/benchmarks/discriminatedUnion.d.ts +0 -1
  5. package/lib/benchmarks/discriminatedUnion.js +0 -1
  6. package/lib/benchmarks/index.d.ts +0 -1
  7. package/lib/benchmarks/index.js +0 -1
  8. package/lib/benchmarks/object.d.ts +0 -1
  9. package/lib/benchmarks/object.js +0 -1
  10. package/lib/benchmarks/string.d.ts +0 -1
  11. package/lib/benchmarks/string.js +0 -1
  12. package/lib/benchmarks/union.d.ts +0 -1
  13. package/lib/benchmarks/union.js +0 -1
  14. package/lib/external.d.ts +0 -1
  15. package/lib/external.js +0 -1
  16. package/lib/helpers/errorUtil.d.ts +0 -1
  17. package/lib/helpers/errorUtil.js +0 -1
  18. package/lib/helpers/parseUtil.d.ts +0 -1
  19. package/lib/helpers/parseUtil.js +0 -1
  20. package/lib/helpers/partialUtil.d.ts +0 -1
  21. package/lib/helpers/partialUtil.js +0 -1
  22. package/lib/helpers/typeAliases.d.ts +0 -1
  23. package/lib/helpers/typeAliases.js +0 -1
  24. package/lib/helpers/util.d.ts +0 -1
  25. package/lib/helpers/util.js +0 -1
  26. package/lib/index.d.ts +0 -1
  27. package/lib/index.js +0 -1
  28. package/lib/index.mjs +3390 -2
  29. package/lib/types.d.ts +6 -4
  30. package/lib/types.js +9 -4
  31. package/package.json +1 -1
  32. package/lib/ZodError.d.ts.map +0 -1
  33. package/lib/ZodError.js.map +0 -1
  34. package/lib/benchmarks/discriminatedUnion.d.ts.map +0 -1
  35. package/lib/benchmarks/discriminatedUnion.js.map +0 -1
  36. package/lib/benchmarks/index.d.ts.map +0 -1
  37. package/lib/benchmarks/index.js.map +0 -1
  38. package/lib/benchmarks/object.d.ts.map +0 -1
  39. package/lib/benchmarks/object.js.map +0 -1
  40. package/lib/benchmarks/string.d.ts.map +0 -1
  41. package/lib/benchmarks/string.js.map +0 -1
  42. package/lib/benchmarks/union.d.ts.map +0 -1
  43. package/lib/benchmarks/union.js.map +0 -1
  44. package/lib/external.d.ts.map +0 -1
  45. package/lib/external.js.map +0 -1
  46. package/lib/helpers/errorUtil.d.ts.map +0 -1
  47. package/lib/helpers/errorUtil.js.map +0 -1
  48. package/lib/helpers/parseUtil.d.ts.map +0 -1
  49. package/lib/helpers/parseUtil.js.map +0 -1
  50. package/lib/helpers/partialUtil.d.ts.map +0 -1
  51. package/lib/helpers/partialUtil.js.map +0 -1
  52. package/lib/helpers/typeAliases.d.ts.map +0 -1
  53. package/lib/helpers/typeAliases.js.map +0 -1
  54. package/lib/helpers/util.d.ts.map +0 -1
  55. package/lib/helpers/util.js.map +0 -1
  56. package/lib/index.d.ts.map +0 -1
  57. package/lib/index.js.map +0 -1
  58. package/lib/index.mjs.map +0 -1
  59. package/lib/types.d.ts.map +0 -1
  60. package/lib/types.js.map +0 -1
package/README.md CHANGED
@@ -244,7 +244,7 @@ There are a growing number of tools that are built atop or support Zod natively!
244
244
  ### Form integrations
245
245
 
246
246
  - [`react-hook-form`](https://github.com/react-hook-form/resolvers#zod): A first-party Zod resolver for React Hook Form
247
- - [`formik`](https://github.com/robertLichtnow/zod-formik-adapter): A community-maintained Formik adapter for Zod
247
+ - [`zod-formik-adapter`](https://github.com/robertLichtnow/zod-formik-adapter): A community-maintained Formik adapter for Zod
248
248
 
249
249
  # Basic usage
250
250
 
@@ -1066,8 +1066,8 @@ interface Category {
1066
1066
  subcategories: Category[];
1067
1067
  }
1068
1068
 
1069
- // cast to z.ZodSchema<Category>
1070
- const Category: z.ZodSchema<Category> = z.lazy(() =>
1069
+ // cast to z.ZodType<Category>
1070
+ const Category: z.ZodType<Category> = z.lazy(() =>
1071
1071
  z.object({
1072
1072
  name: z.string(),
1073
1073
  subcategories: z.array(Category),
@@ -1104,7 +1104,7 @@ interface Category extends z.infer<typeof BaseCategory> {
1104
1104
 
1105
1105
  // merge the base schema with
1106
1106
  // a new Zod schema containing relations
1107
- const Category: z.ZodSchema<Category> = BaseCategory.merge(
1107
+ const Category: z.ZodType<Category> = BaseCategory.merge(
1108
1108
  z.object({
1109
1109
  subcategories: z.lazy(() => z.array(Category)),
1110
1110
  })
@@ -1119,7 +1119,7 @@ If you want to validate any JSON value, you can use the snippet below.
1119
1119
  type Literal = boolean | null | number | string;
1120
1120
  type Json = Literal | { [key: string]: Json } | Json[];
1121
1121
  const literalSchema = z.union([z.string(), z.number(), z.boolean(), z.null()]);
1122
- const jsonSchema: z.ZodSchema<Json> = z.lazy(() =>
1122
+ const jsonSchema: z.ZodType<Json> = z.lazy(() =>
1123
1123
  z.union([literalSchema, z.array(jsonSchema), z.record(jsonSchema)])
1124
1124
  );
1125
1125
 
package/lib/ZodError.d.ts CHANGED
@@ -148,4 +148,3 @@ export declare let overrideErrorMap: (issue: ZodIssueOptionalMessage, _ctx: Erro
148
148
  };
149
149
  export declare const setErrorMap: (map: ZodErrorMap) => void;
150
150
  export {};
151
- //# sourceMappingURL=ZodError.d.ts.map
package/lib/ZodError.js CHANGED
@@ -304,4 +304,3 @@ var setErrorMap = function (map) {
304
304
  exports.overrideErrorMap = map;
305
305
  };
306
306
  exports.setErrorMap = setErrorMap;
307
- //# sourceMappingURL=ZodError.js.map
@@ -3,4 +3,3 @@ declare const _default: {
3
3
  suites: Benchmark.Suite[];
4
4
  };
5
5
  export default _default;
6
- //# sourceMappingURL=discriminatedUnion.d.ts.map
@@ -77,4 +77,3 @@ manySuite
77
77
  exports.default = {
78
78
  suites: [doubleSuite, manySuite],
79
79
  };
80
- //# sourceMappingURL=discriminatedUnion.js.map
@@ -1,2 +1 @@
1
1
  export {};
2
- //# sourceMappingURL=index.d.ts.map
@@ -57,4 +57,3 @@ finally {
57
57
  }
58
58
  finally { if (e_1) throw e_1.error; }
59
59
  }
60
- //# sourceMappingURL=index.js.map
@@ -3,4 +3,3 @@ declare const _default: {
3
3
  suites: Benchmark.Suite[];
4
4
  };
5
5
  export default _default;
6
- //# sourceMappingURL=object.d.ts.map
@@ -68,4 +68,3 @@ longSuite
68
68
  exports.default = {
69
69
  suites: [emptySuite, shortSuite, longSuite],
70
70
  };
71
- //# sourceMappingURL=object.js.map
@@ -3,4 +3,3 @@ declare const _default: {
3
3
  suites: Benchmark.Suite[];
4
4
  };
5
5
  export default _default;
6
- //# sourceMappingURL=string.d.ts.map
@@ -42,4 +42,3 @@ suite
42
42
  exports.default = {
43
43
  suites: [suite],
44
44
  };
45
- //# sourceMappingURL=string.js.map
@@ -3,4 +3,3 @@ declare const _default: {
3
3
  suites: Benchmark.Suite[];
4
4
  };
5
5
  export default _default;
6
- //# sourceMappingURL=union.d.ts.map
@@ -77,4 +77,3 @@ manySuite
77
77
  exports.default = {
78
78
  suites: [doubleSuite, manySuite],
79
79
  };
80
- //# sourceMappingURL=union.js.map
package/lib/external.d.ts CHANGED
@@ -2,4 +2,3 @@ export * from "./helpers/parseUtil";
2
2
  export * from "./helpers/typeAliases";
3
3
  export * from "./types";
4
4
  export * from "./ZodError";
5
- //# sourceMappingURL=external.d.ts.map
package/lib/external.js CHANGED
@@ -14,4 +14,3 @@ __exportStar(require("./helpers/parseUtil"), exports);
14
14
  __exportStar(require("./helpers/typeAliases"), exports);
15
15
  __exportStar(require("./types"), exports);
16
16
  __exportStar(require("./ZodError"), exports);
17
- //# sourceMappingURL=external.js.map
@@ -7,4 +7,3 @@ export declare namespace errorUtil {
7
7
  };
8
8
  const toString: (message?: ErrMessage | undefined) => string | undefined;
9
9
  }
10
- //# sourceMappingURL=errorUtil.d.ts.map
@@ -10,4 +10,3 @@ var errorUtil;
10
10
  return typeof message === "string" ? message : message === null || message === void 0 ? void 0 : message.message;
11
11
  };
12
12
  })(errorUtil = exports.errorUtil || (exports.errorUtil = {}));
13
- //# sourceMappingURL=errorUtil.js.map
@@ -98,4 +98,3 @@ export declare const isAborted: (x: ParseReturnType<any>) => x is INVALID;
98
98
  export declare const isDirty: <T>(x: ParseReturnType<T>) => x is OK<T> | DIRTY<T>;
99
99
  export declare const isValid: <T>(x: ParseReturnType<T>) => x is OK<T> | DIRTY<T>;
100
100
  export declare const isAsync: <T>(x: ParseReturnType<T>) => x is AsyncParseReturnType<T>;
101
- //# sourceMappingURL=parseUtil.d.ts.map
@@ -334,4 +334,3 @@ var isAsync = function (x) {
334
334
  return typeof Promise !== undefined && x instanceof Promise;
335
335
  };
336
336
  exports.isAsync = isAsync;
337
- //# sourceMappingURL=parseUtil.js.map
@@ -6,4 +6,3 @@ export declare namespace partialUtil {
6
6
  [k in keyof Items]: Items[k] extends ZodTypeAny ? DeepPartial<Items[k]> : never;
7
7
  } extends infer PI ? PI extends ZodTupleItems ? ZodTuple<PI> : never : never : T;
8
8
  }
9
- //# sourceMappingURL=partialUtil.d.ts.map
@@ -1,3 +1,2 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- //# sourceMappingURL=partialUtil.js.map
@@ -1,3 +1,2 @@
1
1
  export declare type Primitive = string | number | bigint | boolean | null | undefined;
2
2
  export declare type Scalars = Primitive | Primitive[];
3
- //# sourceMappingURL=typeAliases.d.ts.map
@@ -1,3 +1,2 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- //# sourceMappingURL=typeAliases.js.map
@@ -16,4 +16,3 @@ export declare namespace util {
16
16
  type noUndefined<T> = T extends undefined ? never : T;
17
17
  const isInteger: NumberConstructor["isInteger"];
18
18
  }
19
- //# sourceMappingURL=util.d.ts.map
@@ -95,4 +95,3 @@ var util;
95
95
  return typeof val === "number" && isFinite(val) && Math.floor(val) === val;
96
96
  };
97
97
  })(util = exports.util || (exports.util = {}));
98
- //# sourceMappingURL=util.js.map
package/lib/index.d.ts CHANGED
@@ -2,4 +2,3 @@ import * as mod from "./external";
2
2
  export * from "./external";
3
3
  export { mod as z };
4
4
  export default mod;
5
- //# sourceMappingURL=index.d.ts.map
package/lib/index.js CHANGED
@@ -27,4 +27,3 @@ var mod = __importStar(require("./external"));
27
27
  exports.z = mod;
28
28
  __exportStar(require("./external"), exports);
29
29
  exports.default = mod;
30
- //# sourceMappingURL=index.js.map