zod 3.25.37 → 3.25.39

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.
@@ -73,7 +73,7 @@ function formatError(error, _mapper) {
73
73
  const fieldErrors = { _errors: [] };
74
74
  const processError = (error) => {
75
75
  for (const issue of error.issues) {
76
- if (issue.code === "invalid_union") {
76
+ if (issue.code === "invalid_union" && issue.errors.length) {
77
77
  issue.errors.map((issues) => processError({ issues }));
78
78
  }
79
79
  else if (issue.code === "invalid_key") {
@@ -116,7 +116,8 @@ function treeifyError(error, _mapper) {
116
116
  const processError = (error, path = []) => {
117
117
  var _a, _b;
118
118
  for (const issue of error.issues) {
119
- if (issue.code === "invalid_union") {
119
+ if (issue.code === "invalid_union" && issue.errors.length) {
120
+ // regular union error
120
121
  issue.errors.map((issues) => processError({ issues }, issue.path));
121
122
  }
122
123
  else if (issue.code === "invalid_key") {
@@ -42,7 +42,7 @@ export function formatError(error, _mapper) {
42
42
  const fieldErrors = { _errors: [] };
43
43
  const processError = (error) => {
44
44
  for (const issue of error.issues) {
45
- if (issue.code === "invalid_union") {
45
+ if (issue.code === "invalid_union" && issue.errors.length) {
46
46
  issue.errors.map((issues) => processError({ issues }));
47
47
  }
48
48
  else if (issue.code === "invalid_key") {
@@ -85,7 +85,8 @@ export function treeifyError(error, _mapper) {
85
85
  const processError = (error, path = []) => {
86
86
  var _a, _b;
87
87
  for (const issue of error.issues) {
88
- if (issue.code === "invalid_union") {
88
+ if (issue.code === "invalid_union" && issue.errors.length) {
89
+ // regular union error
89
90
  issue.errors.map((issues) => processError({ issues }, issue.path));
90
91
  }
91
92
  else if (issue.code === "invalid_key") {
@@ -34,6 +34,10 @@ declare function _function(): $ZodFunction;
34
34
  declare function _function<const In extends Array<schemas.$ZodType> = Array<schemas.$ZodType>>(params: {
35
35
  input: In;
36
36
  }): $ZodFunction<$ZodTuple<In, null>, $ZodFunctionOut>;
37
+ declare function _function<const In extends Array<schemas.$ZodType> = Array<schemas.$ZodType>, const Out extends $ZodFunctionOut = $ZodFunctionOut>(params: {
38
+ input: In;
39
+ output: Out;
40
+ }): $ZodFunction<$ZodTuple<In, null>, Out>;
37
41
  declare function _function<const In extends $ZodFunctionIn = $ZodFunctionIn>(params: {
38
42
  input: In;
39
43
  }): $ZodFunction<In, $ZodFunctionOut>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "zod",
3
- "version": "3.25.37",
3
+ "version": "3.25.39",
4
4
  "type": "module",
5
5
  "author": "Colin McDonnell <zod@colinhacks.com>",
6
6
  "description": "TypeScript-first schema declaration and validation library with static type inference",