zod 4.0.0-beta.20250415T232143 → 4.0.0-beta.20250417T034645
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/dist/commonjs/schemas.d.ts +14 -14
- package/dist/esm/schemas.d.ts +14 -14
- package/package.json +2 -2
- package/src/schemas.ts +14 -17
|
@@ -392,21 +392,21 @@ export interface ZodObjectLike<out O = object, out I = object> extends ZodType {
|
|
|
392
392
|
export declare const ZodObjectLike: core.$constructor<ZodObjectLike>;
|
|
393
393
|
export declare function keyof<T extends ZodObject>(schema: T): ZodLiteral<keyof T["_zod"]["def"]["shape"]>;
|
|
394
394
|
export declare function keyof<T extends ZodInterface>(schema: T): ZodLiteral<keyof T["_zod"]["output"]>;
|
|
395
|
-
type ZodInterfacePartial<T extends ZodInterface, Keys extends keyof T["_zod"]["def"]["shape"] = keyof T["_zod"]["def"]["shape"]> = ZodInterface<util.
|
|
395
|
+
type ZodInterfacePartial<T extends ZodInterface, Keys extends keyof T["_zod"]["def"]["shape"] = keyof T["_zod"]["def"]["shape"]> = ZodInterface<util.Extend<T["_zod"]["def"]["shape"], {
|
|
396
396
|
[k in Keys]: ZodOptional<T["_zod"]["def"]["shape"][k]>;
|
|
397
397
|
}>, {
|
|
398
398
|
optional: T["_zod"]["optional"] | (string & Keys);
|
|
399
399
|
defaulted: T["_zod"]["defaulted"];
|
|
400
400
|
extra: T["_zod"]["extra"];
|
|
401
401
|
}>;
|
|
402
|
-
type ZodInterfaceRequired<T extends ZodInterface, Keys extends keyof T["_zod"]["def"]["shape"] = keyof T["_zod"]["def"]["shape"]> = ZodInterface<util.
|
|
402
|
+
type ZodInterfaceRequired<T extends ZodInterface, Keys extends keyof T["_zod"]["def"]["shape"] = keyof T["_zod"]["def"]["shape"]> = ZodInterface<util.Extend<T["_zod"]["def"]["shape"], {
|
|
403
403
|
[k in Keys]: ZodNonOptional<T["_zod"]["def"]["shape"][k]>;
|
|
404
404
|
}>, {
|
|
405
405
|
optional: never;
|
|
406
406
|
defaulted: T["_zod"]["defaulted"];
|
|
407
407
|
extra: T["_zod"]["extra"];
|
|
408
408
|
}>;
|
|
409
|
-
export type MergeInterfaces<A extends ZodInterface, B extends ZodInterface> = ZodInterface<util.
|
|
409
|
+
export type MergeInterfaces<A extends ZodInterface, B extends ZodInterface> = ZodInterface<util.Extend<A["_zod"]["def"]["shape"], B["_zod"]["def"]["shape"]>, util.MergeInterfaceParams<A, B>>;
|
|
410
410
|
export interface ZodInterface<out Shape extends core.$ZodLooseShape = core.$ZodLooseShape, out Params extends core.$ZodInterfaceNamedParams = core.$ZodInterfaceNamedParams> extends ZodType {
|
|
411
411
|
_zod: core.$ZodInterfaceInternals<Shape, Params>;
|
|
412
412
|
keyof(): ZodEnum<util.ToEnum<util.InterfaceKeys<string & keyof Shape>>>;
|
|
@@ -466,10 +466,10 @@ export interface ZodObject<out Shape extends core.$ZodShape = core.$ZodShape, Ex
|
|
|
466
466
|
strict(): ZodObject<Shape, {}>;
|
|
467
467
|
/** @deprecated This is the default behavior. This method call is likely unnecessary. */
|
|
468
468
|
strip(): ZodObject<Shape, {}>;
|
|
469
|
-
extend<const U extends ZodObject>(schema: U): ZodObject<util.
|
|
470
|
-
extend<U extends core.$ZodShape>(shape: U): ZodObject<util.
|
|
469
|
+
extend<const U extends ZodObject>(schema: U): ZodObject<util.Extend<Shape, U["_zod"]["def"]["shape"]>, Extra>;
|
|
470
|
+
extend<U extends core.$ZodShape>(shape: U): ZodObject<util.Extend<Shape, U>, Extra>;
|
|
471
471
|
/** @deprecated Use `A.extend(B)` */
|
|
472
|
-
merge<U extends ZodObject<any, any>>(other: U): ZodObject<util.Flatten<util.
|
|
472
|
+
merge<U extends ZodObject<any, any>>(other: U): ZodObject<util.Flatten<util.Extend<Shape, U["_zod"]["def"]["shape"]>>, Extra>;
|
|
473
473
|
pick<M extends util.Exactly<util.Mask<string & keyof Shape>, M>>(mask: M): ZodObject<util.Flatten<Pick<Shape, Extract<keyof Shape, keyof M>>>, Extra>;
|
|
474
474
|
omit<M extends util.Exactly<util.Mask<string & keyof Shape>, M>>(mask: M): ZodObject<util.Flatten<Omit<Shape, Extract<keyof Shape, keyof M>>>, Extra>;
|
|
475
475
|
partial(): ZodObject<{
|
|
@@ -491,14 +491,14 @@ export declare function strictObject<T extends core.$ZodShape>(shape: T, params?
|
|
|
491
491
|
export declare function looseObject<T extends core.$ZodShape>(shape: T, params?: core.$ZodObjectParams): ZodObject<T, {
|
|
492
492
|
[k: string]: unknown;
|
|
493
493
|
}>;
|
|
494
|
-
export declare function extend<T extends ZodInterface, U extends ZodInterface>(a: T, b: U): ZodInterface<util.
|
|
495
|
-
export declare function extend<T extends ZodObject, U extends ZodObject>(a: T, b: U): ZodObject<util.
|
|
496
|
-
export declare function extend<T extends ZodObjectLike, U extends core.$ZodLooseShape>(schema: T, shape: U): T extends ZodInterface<infer TShape, infer TParams> ? ZodInterface<util.ExtendInterfaceShape<TShape, U>, util.ExtendInterfaceParams<ZodInterface<TShape, TParams>, U>> : ZodObject<util.
|
|
497
|
-
export declare function merge<T extends ZodObjectLike, U extends core.$ZodLooseShape>(schema: T, shape: U): T["_zod"]["def"]["type"] extends "interface" ? ZodInterface<util.
|
|
494
|
+
export declare function extend<T extends ZodInterface, U extends ZodInterface>(a: T, b: U): ZodInterface<util.Extend<T["_zod"]["def"]["shape"], U["_zod"]["def"]["shape"]>, util.MergeInterfaceParams<T, U>>;
|
|
495
|
+
export declare function extend<T extends ZodObject, U extends ZodObject>(a: T, b: U): ZodObject<util.Extend<T["_zod"]["def"]["shape"], U["_zod"]["def"]["shape"]>, U["_zod"]["extra"] & T["_zod"]["extra"]>;
|
|
496
|
+
export declare function extend<T extends ZodObjectLike, U extends core.$ZodLooseShape>(schema: T, shape: U): T extends ZodInterface<infer TShape, infer TParams> ? ZodInterface<util.ExtendInterfaceShape<TShape, U>, util.ExtendInterfaceParams<ZodInterface<TShape, TParams>, U>> : ZodObject<util.Extend<T["_zod"]["def"]["shape"], U>, T["_zod"]["extra"]>;
|
|
497
|
+
export declare function merge<T extends ZodObjectLike, U extends core.$ZodLooseShape>(schema: T, shape: U): T["_zod"]["def"]["type"] extends "interface" ? ZodInterface<util.Extend<T["_zod"]["def"]["shape"], U["_zod"]["def"]["shape"]>, {
|
|
498
498
|
extra: T["_zod"]["extra"] & U["_zod"]["extra"];
|
|
499
499
|
optional: Exclude<T["_zod"]["optional"], keyof U["_zod"]["def"]["shape"]> | U["_zod"]["optional"];
|
|
500
500
|
defaulted: Exclude<T["_zod"]["defaulted"], keyof U["_zod"]["def"]["shape"]> | U["_zod"]["defaulted"];
|
|
501
|
-
}> : ZodObject<util.
|
|
501
|
+
}> : ZodObject<util.Extend<T["_zod"]["def"]["shape"], U>, T["_zod"]["extra"]>;
|
|
502
502
|
export declare function pick<T extends ZodObjectLike, M extends util.Exactly<util.Mask<keyof T["_zod"]["def"]["shape"]>, M>>(schema: T, mask: M): T["_zod"]["def"]["type"] extends "interface" ? ZodInterface<util.Flatten<Pick<T["_zod"]["def"]["shape"], keyof T["_zod"]["def"]["shape"] & keyof M>>, {
|
|
503
503
|
optional: Extract<T["_zod"]["optional"], keyof M>;
|
|
504
504
|
defaulted: Extract<T["_zod"]["defaulted"], keyof M>;
|
|
@@ -518,7 +518,7 @@ export declare function partial<T extends ZodObjectLike>(schema: T): T["_zod"]["
|
|
|
518
518
|
}> : ZodObject<{
|
|
519
519
|
[k in keyof T["_zod"]["def"]["shape"]]: ZodOptional<T["_zod"]["def"]["shape"][k]>;
|
|
520
520
|
}, T["_zod"]["extra"]>;
|
|
521
|
-
export declare function partial<T extends ZodObjectLike, M extends util.Exactly<util.Mask<keyof T["_zod"]["def"]["shape"]>, M>>(schema: T, mask: M): T["_zod"]["def"]["type"] extends "interface" ? ZodInterface<util.
|
|
521
|
+
export declare function partial<T extends ZodObjectLike, M extends util.Exactly<util.Mask<keyof T["_zod"]["def"]["shape"]>, M>>(schema: T, mask: M): T["_zod"]["def"]["type"] extends "interface" ? ZodInterface<util.Extend<T["_zod"]["def"]["shape"], {
|
|
522
522
|
[k in keyof M & keyof T["_zod"]["def"]["shape"]]: ZodOptional<T["_zod"]["def"]["shape"][k]>;
|
|
523
523
|
}>, {
|
|
524
524
|
optional: string & (T["_zod"]["optional"] | keyof M);
|
|
@@ -534,7 +534,7 @@ export declare function required<T extends {
|
|
|
534
534
|
}>;
|
|
535
535
|
export declare function required<T extends {
|
|
536
536
|
_subtype: "object";
|
|
537
|
-
} & ZodObject, M extends util.Exactly<util.Mask<keyof T["_zod"]["def"]["shape"]>, M>>(schema: T, mask: M): ZodObject<util.
|
|
537
|
+
} & ZodObject, M extends util.Exactly<util.Mask<keyof T["_zod"]["def"]["shape"]>, M>>(schema: T, mask: M): ZodObject<util.Extend<T["_zod"]["def"]["shape"], {
|
|
538
538
|
[k in keyof M & keyof T["_zod"]["def"]["shape"]]: ZodNonOptional<T["_zod"]["def"]["shape"][k]>;
|
|
539
539
|
}>>;
|
|
540
540
|
export declare function required<T extends {
|
|
@@ -548,7 +548,7 @@ export declare function required<T extends {
|
|
|
548
548
|
}>;
|
|
549
549
|
export declare function required<T extends {
|
|
550
550
|
_subtype: "interface";
|
|
551
|
-
} & ZodInterface, M extends util.Mask<keyof T["_zod"]["output"]>>(schema: T, mask: M): ZodInterface<util.
|
|
551
|
+
} & ZodInterface, M extends util.Mask<keyof T["_zod"]["output"]>>(schema: T, mask: M): ZodInterface<util.Extend<T["_zod"]["def"]["shape"], {
|
|
552
552
|
[k in keyof M & keyof T["_zod"]["def"]["shape"]]: ZodNonOptional<T["_zod"]["def"]["shape"][k]>;
|
|
553
553
|
}>, {
|
|
554
554
|
optional: Exclude<T["_zod"]["optional"], keyof M>;
|
package/dist/esm/schemas.d.ts
CHANGED
|
@@ -392,21 +392,21 @@ export interface ZodObjectLike<out O = object, out I = object> extends ZodType {
|
|
|
392
392
|
export declare const ZodObjectLike: core.$constructor<ZodObjectLike>;
|
|
393
393
|
export declare function keyof<T extends ZodObject>(schema: T): ZodLiteral<keyof T["_zod"]["def"]["shape"]>;
|
|
394
394
|
export declare function keyof<T extends ZodInterface>(schema: T): ZodLiteral<keyof T["_zod"]["output"]>;
|
|
395
|
-
type ZodInterfacePartial<T extends ZodInterface, Keys extends keyof T["_zod"]["def"]["shape"] = keyof T["_zod"]["def"]["shape"]> = ZodInterface<util.
|
|
395
|
+
type ZodInterfacePartial<T extends ZodInterface, Keys extends keyof T["_zod"]["def"]["shape"] = keyof T["_zod"]["def"]["shape"]> = ZodInterface<util.Extend<T["_zod"]["def"]["shape"], {
|
|
396
396
|
[k in Keys]: ZodOptional<T["_zod"]["def"]["shape"][k]>;
|
|
397
397
|
}>, {
|
|
398
398
|
optional: T["_zod"]["optional"] | (string & Keys);
|
|
399
399
|
defaulted: T["_zod"]["defaulted"];
|
|
400
400
|
extra: T["_zod"]["extra"];
|
|
401
401
|
}>;
|
|
402
|
-
type ZodInterfaceRequired<T extends ZodInterface, Keys extends keyof T["_zod"]["def"]["shape"] = keyof T["_zod"]["def"]["shape"]> = ZodInterface<util.
|
|
402
|
+
type ZodInterfaceRequired<T extends ZodInterface, Keys extends keyof T["_zod"]["def"]["shape"] = keyof T["_zod"]["def"]["shape"]> = ZodInterface<util.Extend<T["_zod"]["def"]["shape"], {
|
|
403
403
|
[k in Keys]: ZodNonOptional<T["_zod"]["def"]["shape"][k]>;
|
|
404
404
|
}>, {
|
|
405
405
|
optional: never;
|
|
406
406
|
defaulted: T["_zod"]["defaulted"];
|
|
407
407
|
extra: T["_zod"]["extra"];
|
|
408
408
|
}>;
|
|
409
|
-
export type MergeInterfaces<A extends ZodInterface, B extends ZodInterface> = ZodInterface<util.
|
|
409
|
+
export type MergeInterfaces<A extends ZodInterface, B extends ZodInterface> = ZodInterface<util.Extend<A["_zod"]["def"]["shape"], B["_zod"]["def"]["shape"]>, util.MergeInterfaceParams<A, B>>;
|
|
410
410
|
export interface ZodInterface<out Shape extends core.$ZodLooseShape = core.$ZodLooseShape, out Params extends core.$ZodInterfaceNamedParams = core.$ZodInterfaceNamedParams> extends ZodType {
|
|
411
411
|
_zod: core.$ZodInterfaceInternals<Shape, Params>;
|
|
412
412
|
keyof(): ZodEnum<util.ToEnum<util.InterfaceKeys<string & keyof Shape>>>;
|
|
@@ -466,10 +466,10 @@ export interface ZodObject<out Shape extends core.$ZodShape = core.$ZodShape, Ex
|
|
|
466
466
|
strict(): ZodObject<Shape, {}>;
|
|
467
467
|
/** @deprecated This is the default behavior. This method call is likely unnecessary. */
|
|
468
468
|
strip(): ZodObject<Shape, {}>;
|
|
469
|
-
extend<const U extends ZodObject>(schema: U): ZodObject<util.
|
|
470
|
-
extend<U extends core.$ZodShape>(shape: U): ZodObject<util.
|
|
469
|
+
extend<const U extends ZodObject>(schema: U): ZodObject<util.Extend<Shape, U["_zod"]["def"]["shape"]>, Extra>;
|
|
470
|
+
extend<U extends core.$ZodShape>(shape: U): ZodObject<util.Extend<Shape, U>, Extra>;
|
|
471
471
|
/** @deprecated Use `A.extend(B)` */
|
|
472
|
-
merge<U extends ZodObject<any, any>>(other: U): ZodObject<util.Flatten<util.
|
|
472
|
+
merge<U extends ZodObject<any, any>>(other: U): ZodObject<util.Flatten<util.Extend<Shape, U["_zod"]["def"]["shape"]>>, Extra>;
|
|
473
473
|
pick<M extends util.Exactly<util.Mask<string & keyof Shape>, M>>(mask: M): ZodObject<util.Flatten<Pick<Shape, Extract<keyof Shape, keyof M>>>, Extra>;
|
|
474
474
|
omit<M extends util.Exactly<util.Mask<string & keyof Shape>, M>>(mask: M): ZodObject<util.Flatten<Omit<Shape, Extract<keyof Shape, keyof M>>>, Extra>;
|
|
475
475
|
partial(): ZodObject<{
|
|
@@ -491,14 +491,14 @@ export declare function strictObject<T extends core.$ZodShape>(shape: T, params?
|
|
|
491
491
|
export declare function looseObject<T extends core.$ZodShape>(shape: T, params?: core.$ZodObjectParams): ZodObject<T, {
|
|
492
492
|
[k: string]: unknown;
|
|
493
493
|
}>;
|
|
494
|
-
export declare function extend<T extends ZodInterface, U extends ZodInterface>(a: T, b: U): ZodInterface<util.
|
|
495
|
-
export declare function extend<T extends ZodObject, U extends ZodObject>(a: T, b: U): ZodObject<util.
|
|
496
|
-
export declare function extend<T extends ZodObjectLike, U extends core.$ZodLooseShape>(schema: T, shape: U): T extends ZodInterface<infer TShape, infer TParams> ? ZodInterface<util.ExtendInterfaceShape<TShape, U>, util.ExtendInterfaceParams<ZodInterface<TShape, TParams>, U>> : ZodObject<util.
|
|
497
|
-
export declare function merge<T extends ZodObjectLike, U extends core.$ZodLooseShape>(schema: T, shape: U): T["_zod"]["def"]["type"] extends "interface" ? ZodInterface<util.
|
|
494
|
+
export declare function extend<T extends ZodInterface, U extends ZodInterface>(a: T, b: U): ZodInterface<util.Extend<T["_zod"]["def"]["shape"], U["_zod"]["def"]["shape"]>, util.MergeInterfaceParams<T, U>>;
|
|
495
|
+
export declare function extend<T extends ZodObject, U extends ZodObject>(a: T, b: U): ZodObject<util.Extend<T["_zod"]["def"]["shape"], U["_zod"]["def"]["shape"]>, U["_zod"]["extra"] & T["_zod"]["extra"]>;
|
|
496
|
+
export declare function extend<T extends ZodObjectLike, U extends core.$ZodLooseShape>(schema: T, shape: U): T extends ZodInterface<infer TShape, infer TParams> ? ZodInterface<util.ExtendInterfaceShape<TShape, U>, util.ExtendInterfaceParams<ZodInterface<TShape, TParams>, U>> : ZodObject<util.Extend<T["_zod"]["def"]["shape"], U>, T["_zod"]["extra"]>;
|
|
497
|
+
export declare function merge<T extends ZodObjectLike, U extends core.$ZodLooseShape>(schema: T, shape: U): T["_zod"]["def"]["type"] extends "interface" ? ZodInterface<util.Extend<T["_zod"]["def"]["shape"], U["_zod"]["def"]["shape"]>, {
|
|
498
498
|
extra: T["_zod"]["extra"] & U["_zod"]["extra"];
|
|
499
499
|
optional: Exclude<T["_zod"]["optional"], keyof U["_zod"]["def"]["shape"]> | U["_zod"]["optional"];
|
|
500
500
|
defaulted: Exclude<T["_zod"]["defaulted"], keyof U["_zod"]["def"]["shape"]> | U["_zod"]["defaulted"];
|
|
501
|
-
}> : ZodObject<util.
|
|
501
|
+
}> : ZodObject<util.Extend<T["_zod"]["def"]["shape"], U>, T["_zod"]["extra"]>;
|
|
502
502
|
export declare function pick<T extends ZodObjectLike, M extends util.Exactly<util.Mask<keyof T["_zod"]["def"]["shape"]>, M>>(schema: T, mask: M): T["_zod"]["def"]["type"] extends "interface" ? ZodInterface<util.Flatten<Pick<T["_zod"]["def"]["shape"], keyof T["_zod"]["def"]["shape"] & keyof M>>, {
|
|
503
503
|
optional: Extract<T["_zod"]["optional"], keyof M>;
|
|
504
504
|
defaulted: Extract<T["_zod"]["defaulted"], keyof M>;
|
|
@@ -518,7 +518,7 @@ export declare function partial<T extends ZodObjectLike>(schema: T): T["_zod"]["
|
|
|
518
518
|
}> : ZodObject<{
|
|
519
519
|
[k in keyof T["_zod"]["def"]["shape"]]: ZodOptional<T["_zod"]["def"]["shape"][k]>;
|
|
520
520
|
}, T["_zod"]["extra"]>;
|
|
521
|
-
export declare function partial<T extends ZodObjectLike, M extends util.Exactly<util.Mask<keyof T["_zod"]["def"]["shape"]>, M>>(schema: T, mask: M): T["_zod"]["def"]["type"] extends "interface" ? ZodInterface<util.
|
|
521
|
+
export declare function partial<T extends ZodObjectLike, M extends util.Exactly<util.Mask<keyof T["_zod"]["def"]["shape"]>, M>>(schema: T, mask: M): T["_zod"]["def"]["type"] extends "interface" ? ZodInterface<util.Extend<T["_zod"]["def"]["shape"], {
|
|
522
522
|
[k in keyof M & keyof T["_zod"]["def"]["shape"]]: ZodOptional<T["_zod"]["def"]["shape"][k]>;
|
|
523
523
|
}>, {
|
|
524
524
|
optional: string & (T["_zod"]["optional"] | keyof M);
|
|
@@ -534,7 +534,7 @@ export declare function required<T extends {
|
|
|
534
534
|
}>;
|
|
535
535
|
export declare function required<T extends {
|
|
536
536
|
_subtype: "object";
|
|
537
|
-
} & ZodObject, M extends util.Exactly<util.Mask<keyof T["_zod"]["def"]["shape"]>, M>>(schema: T, mask: M): ZodObject<util.
|
|
537
|
+
} & ZodObject, M extends util.Exactly<util.Mask<keyof T["_zod"]["def"]["shape"]>, M>>(schema: T, mask: M): ZodObject<util.Extend<T["_zod"]["def"]["shape"], {
|
|
538
538
|
[k in keyof M & keyof T["_zod"]["def"]["shape"]]: ZodNonOptional<T["_zod"]["def"]["shape"][k]>;
|
|
539
539
|
}>>;
|
|
540
540
|
export declare function required<T extends {
|
|
@@ -548,7 +548,7 @@ export declare function required<T extends {
|
|
|
548
548
|
}>;
|
|
549
549
|
export declare function required<T extends {
|
|
550
550
|
_subtype: "interface";
|
|
551
|
-
} & ZodInterface, M extends util.Mask<keyof T["_zod"]["output"]>>(schema: T, mask: M): ZodInterface<util.
|
|
551
|
+
} & ZodInterface, M extends util.Mask<keyof T["_zod"]["output"]>>(schema: T, mask: M): ZodInterface<util.Extend<T["_zod"]["def"]["shape"], {
|
|
552
552
|
[k in keyof M & keyof T["_zod"]["def"]["shape"]]: ZodNonOptional<T["_zod"]["def"]["shape"][k]>;
|
|
553
553
|
}>, {
|
|
554
554
|
optional: Exclude<T["_zod"]["optional"], keyof M>;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "zod",
|
|
3
|
-
"version": "4.0.0-beta.
|
|
3
|
+
"version": "4.0.0-beta.20250417T034645",
|
|
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",
|
|
@@ -70,7 +70,7 @@
|
|
|
70
70
|
}
|
|
71
71
|
},
|
|
72
72
|
"dependencies": {
|
|
73
|
-
"@zod/core": "0.
|
|
73
|
+
"@zod/core": "0.6.1"
|
|
74
74
|
},
|
|
75
75
|
"scripts": {
|
|
76
76
|
"clean": "rm -rf dist",
|
package/src/schemas.ts
CHANGED
|
@@ -1035,7 +1035,7 @@ type ZodInterfacePartial<
|
|
|
1035
1035
|
T extends ZodInterface,
|
|
1036
1036
|
Keys extends keyof T["_zod"]["def"]["shape"] = keyof T["_zod"]["def"]["shape"],
|
|
1037
1037
|
> = ZodInterface<
|
|
1038
|
-
util.
|
|
1038
|
+
util.Extend<
|
|
1039
1039
|
T["_zod"]["def"]["shape"],
|
|
1040
1040
|
{
|
|
1041
1041
|
[k in Keys]: ZodOptional<T["_zod"]["def"]["shape"][k]>;
|
|
@@ -1052,7 +1052,7 @@ type ZodInterfaceRequired<
|
|
|
1052
1052
|
T extends ZodInterface,
|
|
1053
1053
|
Keys extends keyof T["_zod"]["def"]["shape"] = keyof T["_zod"]["def"]["shape"],
|
|
1054
1054
|
> = ZodInterface<
|
|
1055
|
-
util.
|
|
1055
|
+
util.Extend<
|
|
1056
1056
|
T["_zod"]["def"]["shape"],
|
|
1057
1057
|
{
|
|
1058
1058
|
[k in Keys]: ZodNonOptional<T["_zod"]["def"]["shape"][k]>;
|
|
@@ -1066,7 +1066,7 @@ type ZodInterfaceRequired<
|
|
|
1066
1066
|
>;
|
|
1067
1067
|
|
|
1068
1068
|
export type MergeInterfaces<A extends ZodInterface, B extends ZodInterface> = ZodInterface<
|
|
1069
|
-
util.
|
|
1069
|
+
util.Extend<A["_zod"]["def"]["shape"], B["_zod"]["def"]["shape"]>,
|
|
1070
1070
|
util.MergeInterfaceParams<A, B>
|
|
1071
1071
|
>;
|
|
1072
1072
|
|
|
@@ -1270,11 +1270,11 @@ export interface ZodObject<
|
|
|
1270
1270
|
/** @deprecated This is the default behavior. This method call is likely unnecessary. */
|
|
1271
1271
|
strip(): ZodObject<Shape, {}>;
|
|
1272
1272
|
|
|
1273
|
-
extend<const U extends ZodObject>(schema: U): ZodObject<util.
|
|
1273
|
+
extend<const U extends ZodObject>(schema: U): ZodObject<util.Extend<Shape, U["_zod"]["def"]["shape"]>, Extra>;
|
|
1274
1274
|
extend<U extends core.$ZodShape>(
|
|
1275
1275
|
shape: U
|
|
1276
1276
|
): ZodObject<
|
|
1277
|
-
util.
|
|
1277
|
+
util.Extend<Shape, U>,
|
|
1278
1278
|
Extra // & B['_zod']["extra"]
|
|
1279
1279
|
>;
|
|
1280
1280
|
|
|
@@ -1282,7 +1282,7 @@ export interface ZodObject<
|
|
|
1282
1282
|
/** @deprecated Use `A.extend(B)` */
|
|
1283
1283
|
merge<U extends ZodObject<any, any>>(
|
|
1284
1284
|
other: U
|
|
1285
|
-
): ZodObject<util.Flatten<util.
|
|
1285
|
+
): ZodObject<util.Flatten<util.Extend<Shape, U["_zod"]["def"]["shape"]>>, Extra>;
|
|
1286
1286
|
|
|
1287
1287
|
pick<M extends util.Exactly<util.Mask<string & keyof Shape>, M>>(
|
|
1288
1288
|
mask: M
|
|
@@ -1396,15 +1396,12 @@ export function looseObject<T extends core.$ZodShape>(
|
|
|
1396
1396
|
export function extend<T extends ZodInterface, U extends ZodInterface>(
|
|
1397
1397
|
a: T,
|
|
1398
1398
|
b: U
|
|
1399
|
-
): ZodInterface<
|
|
1400
|
-
util.ExtendShape<T["_zod"]["def"]["shape"], U["_zod"]["def"]["shape"]>,
|
|
1401
|
-
util.MergeInterfaceParams<T, U>
|
|
1402
|
-
>;
|
|
1399
|
+
): ZodInterface<util.Extend<T["_zod"]["def"]["shape"], U["_zod"]["def"]["shape"]>, util.MergeInterfaceParams<T, U>>;
|
|
1403
1400
|
export function extend<T extends ZodObject, U extends ZodObject>(
|
|
1404
1401
|
a: T,
|
|
1405
1402
|
b: U
|
|
1406
1403
|
): ZodObject<
|
|
1407
|
-
util.
|
|
1404
|
+
util.Extend<T["_zod"]["def"]["shape"], U["_zod"]["def"]["shape"]>,
|
|
1408
1405
|
U["_zod"]["extra"] & T["_zod"]["extra"]
|
|
1409
1406
|
>;
|
|
1410
1407
|
export function extend<T extends ZodObjectLike, U extends core.$ZodLooseShape>(
|
|
@@ -1412,7 +1409,7 @@ export function extend<T extends ZodObjectLike, U extends core.$ZodLooseShape>(
|
|
|
1412
1409
|
shape: U
|
|
1413
1410
|
): T extends ZodInterface<infer TShape, infer TParams>
|
|
1414
1411
|
? ZodInterface<util.ExtendInterfaceShape<TShape, U>, util.ExtendInterfaceParams<ZodInterface<TShape, TParams>, U>>
|
|
1415
|
-
: ZodObject<util.
|
|
1412
|
+
: ZodObject<util.Extend<T["_zod"]["def"]["shape"], U>, T["_zod"]["extra"]>;
|
|
1416
1413
|
export function extend(schema: ZodObjectLike, shape: core.$ZodShape): ZodObjectLike {
|
|
1417
1414
|
if (shape instanceof core.$ZodType) return util.mergeObjectLike(schema, shape as any);
|
|
1418
1415
|
if (schema instanceof ZodInterface) {
|
|
@@ -1428,14 +1425,14 @@ export function merge<T extends ZodObjectLike, U extends core.$ZodLooseShape>(
|
|
|
1428
1425
|
): T["_zod"]["def"]["type"] extends "interface"
|
|
1429
1426
|
? // T extends ZodInterface
|
|
1430
1427
|
ZodInterface<
|
|
1431
|
-
util.
|
|
1428
|
+
util.Extend<T["_zod"]["def"]["shape"], U["_zod"]["def"]["shape"]>,
|
|
1432
1429
|
{
|
|
1433
1430
|
extra: T["_zod"]["extra"] & U["_zod"]["extra"];
|
|
1434
1431
|
optional: Exclude<T["_zod"]["optional"], keyof U["_zod"]["def"]["shape"]> | U["_zod"]["optional"];
|
|
1435
1432
|
defaulted: Exclude<T["_zod"]["defaulted"], keyof U["_zod"]["def"]["shape"]> | U["_zod"]["defaulted"];
|
|
1436
1433
|
}
|
|
1437
1434
|
>
|
|
1438
|
-
: ZodObject<util.
|
|
1435
|
+
: ZodObject<util.Extend<T["_zod"]["def"]["shape"], U>, T["_zod"]["extra"]>;
|
|
1439
1436
|
export function merge(a: ZodObjectLike, b: ZodObjectLike): ZodObjectLike {
|
|
1440
1437
|
return util.mergeObjectLike(a, b);
|
|
1441
1438
|
}
|
|
@@ -1509,7 +1506,7 @@ export function partial<T extends ZodObjectLike, M extends util.Exactly<util.Mas
|
|
|
1509
1506
|
mask: M
|
|
1510
1507
|
): T["_zod"]["def"]["type"] extends "interface"
|
|
1511
1508
|
? ZodInterface<
|
|
1512
|
-
util.
|
|
1509
|
+
util.Extend<
|
|
1513
1510
|
T["_zod"]["def"]["shape"],
|
|
1514
1511
|
{
|
|
1515
1512
|
[k in keyof M & keyof T["_zod"]["def"]["shape"]]: ZodOptional<T["_zod"]["def"]["shape"][k]>;
|
|
@@ -1547,7 +1544,7 @@ export function required<
|
|
|
1547
1544
|
schema: T,
|
|
1548
1545
|
mask: M
|
|
1549
1546
|
): ZodObject<
|
|
1550
|
-
util.
|
|
1547
|
+
util.Extend<
|
|
1551
1548
|
T["_zod"]["def"]["shape"],
|
|
1552
1549
|
{
|
|
1553
1550
|
[k in keyof M & keyof T["_zod"]["def"]["shape"]]: ZodNonOptional<T["_zod"]["def"]["shape"][k]>;
|
|
@@ -1573,7 +1570,7 @@ export function required<
|
|
|
1573
1570
|
schema: T,
|
|
1574
1571
|
mask: M
|
|
1575
1572
|
): ZodInterface<
|
|
1576
|
-
util.
|
|
1573
|
+
util.Extend<
|
|
1577
1574
|
T["_zod"]["def"]["shape"],
|
|
1578
1575
|
{
|
|
1579
1576
|
[k in keyof M & keyof T["_zod"]["def"]["shape"]]: ZodNonOptional<T["_zod"]["def"]["shape"][k]>;
|