zod 4.1.0-canary.20250710T223408 → 4.1.0-canary.20250711T052917
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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "zod",
|
|
3
|
-
"version": "4.1.0-canary.
|
|
3
|
+
"version": "4.1.0-canary.20250711T052917",
|
|
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",
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { expect, expectTypeOf, test } from "vitest";
|
|
2
2
|
import { z } from "zod/v4";
|
|
3
|
-
import type { util } from "zod/v4/core";
|
|
4
3
|
|
|
5
4
|
test("basic catch", () => {
|
|
6
5
|
expect(z.string().catch("default").parse(undefined)).toBe("default");
|
|
@@ -45,7 +44,7 @@ test("catch with transform", () => {
|
|
|
45
44
|
expect(stringWithDefault.unwrap().out).toBeInstanceOf(z.ZodTransform);
|
|
46
45
|
|
|
47
46
|
type inp = z.input<typeof stringWithDefault>;
|
|
48
|
-
expectTypeOf<inp>().toEqualTypeOf<string
|
|
47
|
+
expectTypeOf<inp>().toEqualTypeOf<string>();
|
|
49
48
|
type out = z.output<typeof stringWithDefault>;
|
|
50
49
|
expectTypeOf<out>().toEqualTypeOf<string>();
|
|
51
50
|
});
|
|
@@ -59,7 +58,7 @@ test("catch on existing optional", () => {
|
|
|
59
58
|
expect(stringWithDefault.unwrap().unwrap()).toBeInstanceOf(z.ZodString);
|
|
60
59
|
|
|
61
60
|
type inp = z.input<typeof stringWithDefault>;
|
|
62
|
-
expectTypeOf<inp>().toEqualTypeOf<string | undefined
|
|
61
|
+
expectTypeOf<inp>().toEqualTypeOf<string | undefined>();
|
|
63
62
|
type out = z.output<typeof stringWithDefault>;
|
|
64
63
|
expectTypeOf<out>().toEqualTypeOf<string | undefined>();
|
|
65
64
|
});
|
|
@@ -68,7 +67,7 @@ test("optional on catch", () => {
|
|
|
68
67
|
const stringWithDefault = z.string().catch("asdf").optional();
|
|
69
68
|
|
|
70
69
|
type inp = z.input<typeof stringWithDefault>;
|
|
71
|
-
expectTypeOf<inp>().toEqualTypeOf<string |
|
|
70
|
+
expectTypeOf<inp>().toEqualTypeOf<string | undefined>();
|
|
72
71
|
type out = z.output<typeof stringWithDefault>;
|
|
73
72
|
expectTypeOf<out>().toEqualTypeOf<string | undefined>();
|
|
74
73
|
});
|
|
@@ -102,7 +101,7 @@ test("nested", () => {
|
|
|
102
101
|
inner: "asdf",
|
|
103
102
|
});
|
|
104
103
|
type input = z.input<typeof outer>;
|
|
105
|
-
expectTypeOf<input>().toEqualTypeOf<{ inner: string
|
|
104
|
+
expectTypeOf<input>().toEqualTypeOf<{ inner: string }>();
|
|
106
105
|
type out = z.output<typeof outer>;
|
|
107
106
|
|
|
108
107
|
expectTypeOf<out>().toEqualTypeOf<{ inner: string }>();
|
package/src/v4/core/schemas.ts
CHANGED
|
@@ -3315,11 +3315,8 @@ export interface $ZodCatchDef<T extends SomeType = $ZodType> extends $ZodTypeDef
|
|
|
3315
3315
|
}
|
|
3316
3316
|
|
|
3317
3317
|
export interface $ZodCatchInternals<T extends SomeType = $ZodType>
|
|
3318
|
-
extends $ZodTypeInternals<core.output<T>, core.input<T
|
|
3318
|
+
extends $ZodTypeInternals<core.output<T>, core.input<T>> {
|
|
3319
3319
|
def: $ZodCatchDef<T>;
|
|
3320
|
-
// qin: T["_zod"]["qin"];
|
|
3321
|
-
// qout: T["_zod"]["qout"];
|
|
3322
|
-
|
|
3323
3320
|
optin: T["_zod"]["optin"];
|
|
3324
3321
|
optout: T["_zod"]["optout"];
|
|
3325
3322
|
isst: never;
|
package/src/v4/core/versions.ts
CHANGED
package/v4/core/schemas.d.cts
CHANGED
|
@@ -902,7 +902,7 @@ export interface $ZodCatchDef<T extends SomeType = $ZodType> extends $ZodTypeDef
|
|
|
902
902
|
innerType: T;
|
|
903
903
|
catchValue: (ctx: $ZodCatchCtx) => unknown;
|
|
904
904
|
}
|
|
905
|
-
export interface $ZodCatchInternals<T extends SomeType = $ZodType> extends $ZodTypeInternals<core.output<T>, core.input<T
|
|
905
|
+
export interface $ZodCatchInternals<T extends SomeType = $ZodType> extends $ZodTypeInternals<core.output<T>, core.input<T>> {
|
|
906
906
|
def: $ZodCatchDef<T>;
|
|
907
907
|
optin: T["_zod"]["optin"];
|
|
908
908
|
optout: T["_zod"]["optout"];
|
package/v4/core/schemas.d.ts
CHANGED
|
@@ -902,7 +902,7 @@ export interface $ZodCatchDef<T extends SomeType = $ZodType> extends $ZodTypeDef
|
|
|
902
902
|
innerType: T;
|
|
903
903
|
catchValue: (ctx: $ZodCatchCtx) => unknown;
|
|
904
904
|
}
|
|
905
|
-
export interface $ZodCatchInternals<T extends SomeType = $ZodType> extends $ZodTypeInternals<core.output<T>, core.input<T
|
|
905
|
+
export interface $ZodCatchInternals<T extends SomeType = $ZodType> extends $ZodTypeInternals<core.output<T>, core.input<T>> {
|
|
906
906
|
def: $ZodCatchDef<T>;
|
|
907
907
|
optin: T["_zod"]["optin"];
|
|
908
908
|
optout: T["_zod"]["optout"];
|
package/v4/core/versions.cjs
CHANGED
package/v4/core/versions.js
CHANGED