zod 3.25.36 → 3.25.37

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.
@@ -92,7 +92,9 @@ exports.$ZodFunction = $ZodFunction;
92
92
  function _function(params) {
93
93
  return new $ZodFunction({
94
94
  type: "function",
95
- input: Array.isArray(params?.input) ? (0, api_js_1._tuple)(schemas.$ZodTuple, params?.input) : (params?.input ?? null),
96
- output: params?.output ?? null,
95
+ input: Array.isArray(params?.input)
96
+ ? (0, api_js_1._tuple)(schemas.$ZodTuple, params?.input)
97
+ : (params?.input ?? (0, api_js_1._array)(schemas.$ZodArray, (0, api_js_1._unknown)(schemas.$ZodUnknown))),
98
+ output: params?.output ?? (0, api_js_1._unknown)(schemas.$ZodUnknown),
97
99
  });
98
100
  }
@@ -1,4 +1,4 @@
1
- import { _tuple } from "./api.js";
1
+ import { _array, _tuple, _unknown } from "./api.js";
2
2
  import { parse, parseAsync } from "./parse.js";
3
3
  import * as schemas from "./schemas.js";
4
4
  import { $ZodTuple } from "./schemas.js";
@@ -64,8 +64,10 @@ export class $ZodFunction {
64
64
  function _function(params) {
65
65
  return new $ZodFunction({
66
66
  type: "function",
67
- input: Array.isArray(params?.input) ? _tuple(schemas.$ZodTuple, params?.input) : (params?.input ?? null),
68
- output: params?.output ?? null,
67
+ input: Array.isArray(params?.input)
68
+ ? _tuple(schemas.$ZodTuple, params?.input)
69
+ : (params?.input ?? _array(schemas.$ZodArray, _unknown(schemas.$ZodUnknown))),
70
+ output: params?.output ?? _unknown(schemas.$ZodUnknown),
69
71
  });
70
72
  }
71
73
  export { _function as function };
@@ -7,12 +7,12 @@ export interface $ZodFunctionDef<In extends $ZodFunctionIn = $ZodFunctionIn, Out
7
7
  output: Out;
8
8
  }
9
9
  export type $ZodFunctionArgs = schemas.$ZodType<unknown[], unknown[]>;
10
- export type $ZodFunctionIn = $ZodFunctionArgs | null;
11
- export type $ZodFunctionOut = schemas.$ZodType | null;
12
- export type $InferInnerFunctionType<Args extends $ZodFunctionIn, Returns extends $ZodFunctionOut> = (...args: null extends Args ? never[] : NonNullable<Args>["_zod"]["output"]) => null extends Returns ? unknown : NonNullable<Returns>["_zod"]["input"];
13
- export type $InferInnerFunctionTypeAsync<Args extends $ZodFunctionIn, Returns extends $ZodFunctionOut> = (...args: null extends Args ? never[] : NonNullable<Args>["_zod"]["output"]) => null extends Returns ? unknown : util.MaybeAsync<NonNullable<Returns>["_zod"]["input"]>;
14
- export type $InferOuterFunctionType<Args extends $ZodFunctionIn, Returns extends $ZodFunctionOut> = (...args: null extends Args ? never[] : NonNullable<Args>["_zod"]["input"]) => null extends Returns ? unknown : NonNullable<Returns>["_zod"]["output"];
15
- export type $InferOuterFunctionTypeAsync<Args extends $ZodFunctionIn, Returns extends $ZodFunctionOut> = (...args: null extends Args ? never[] : NonNullable<Args>["_zod"]["input"]) => null extends Returns ? unknown : util.MaybeAsync<NonNullable<Returns>["_zod"]["output"]>;
10
+ export type $ZodFunctionIn = $ZodFunctionArgs;
11
+ export type $ZodFunctionOut = schemas.$ZodType;
12
+ export type $InferInnerFunctionType<Args extends $ZodFunctionIn, Returns extends $ZodFunctionOut> = (...args: $ZodFunctionIn extends Args ? never[] : Args["_zod"]["output"]) => Returns["_zod"]["input"];
13
+ export type $InferInnerFunctionTypeAsync<Args extends $ZodFunctionIn, Returns extends $ZodFunctionOut> = (...args: $ZodFunctionIn extends Args ? never[] : Args["_zod"]["output"]) => util.MaybeAsync<Returns["_zod"]["input"]>;
14
+ export type $InferOuterFunctionType<Args extends $ZodFunctionIn, Returns extends $ZodFunctionOut> = (...args: $ZodFunctionIn extends Args ? never[] : Args["_zod"]["input"]) => Returns["_zod"]["output"];
15
+ export type $InferOuterFunctionTypeAsync<Args extends $ZodFunctionIn, Returns extends $ZodFunctionOut> = (...args: $ZodFunctionIn extends Args ? never[] : Args["_zod"]["input"]) => util.MaybeAsync<Returns["_zod"]["output"]>;
16
16
  export declare class $ZodFunction<Args extends $ZodFunctionIn = $ZodFunctionIn, Returns extends $ZodFunctionOut = $ZodFunctionOut> {
17
17
  def: $ZodFunctionDef<Args, Returns>;
18
18
  /** @deprecated */
@@ -20,9 +20,9 @@ export declare class $ZodFunction<Args extends $ZodFunctionIn = $ZodFunctionIn,
20
20
  _input: $InferInnerFunctionType<Args, Returns>;
21
21
  _output: $InferOuterFunctionType<Args, Returns>;
22
22
  constructor(def: $ZodFunctionDef<Args, Returns>);
23
- implement<F extends $InferInnerFunctionType<Args, Returns>>(func: F): F extends this["_output"] ? F : this["_output"];
23
+ implement<F extends $InferInnerFunctionType<Args, Returns>>(func: F): (...args: Parameters<this["_output"]>) => ReturnType<F> extends ReturnType<this["_output"]> ? ReturnType<F> : ReturnType<this["_output"]>;
24
24
  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 = null>(args: Items, rest?: Rest): $ZodFunction<schemas.$ZodTuple<Items, Rest>, Returns>;
25
+ input<const Items extends util.TupleItems, const Rest extends $ZodFunctionOut = $ZodFunctionOut>(args: Items, rest?: Rest): $ZodFunction<schemas.$ZodTuple<Items, Rest>, Returns>;
26
26
  input<NewArgs extends $ZodFunctionIn>(args: NewArgs): $ZodFunction<NewArgs, Returns>;
27
27
  output<NewReturns extends schemas.$ZodType>(output: NewReturns): $ZodFunction<Args, NewReturns>;
28
28
  }
@@ -33,13 +33,13 @@ export interface $ZodFunctionParams<I extends $ZodFunctionIn, O extends schemas.
33
33
  declare function _function(): $ZodFunction;
34
34
  declare function _function<const In extends Array<schemas.$ZodType> = Array<schemas.$ZodType>>(params: {
35
35
  input: In;
36
- }): $ZodFunction<$ZodTuple<In, null>, null>;
36
+ }): $ZodFunction<$ZodTuple<In, null>, $ZodFunctionOut>;
37
37
  declare function _function<const In extends $ZodFunctionIn = $ZodFunctionIn>(params: {
38
38
  input: In;
39
- }): $ZodFunction<In, null>;
39
+ }): $ZodFunction<In, $ZodFunctionOut>;
40
40
  declare function _function<const Out extends $ZodFunctionOut = $ZodFunctionOut>(params: {
41
41
  output: Out;
42
- }): $ZodFunction<null, Out>;
42
+ }): $ZodFunction<$ZodFunctionIn, Out>;
43
43
  declare function _function<In extends $ZodFunctionIn = $ZodFunctionIn, Out extends schemas.$ZodType = schemas.$ZodType>(params?: {
44
44
  input: In;
45
45
  output: Out;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "zod",
3
- "version": "3.25.36",
3
+ "version": "3.25.37",
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",