Skip to content

Commit ff4af5e

Browse files
committed
4.0.3
1 parent 74006ed commit ff4af5e

File tree

3 files changed

+6
-20
lines changed

3 files changed

+6
-20
lines changed

packages/zod/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "zod",
3-
"version": "4.0.2",
3+
"version": "4.0.3",
44
"type": "module",
55
"author": "Colin McDonnell <[email protected]>",
66
"description": "TypeScript-first schema declaration and validation library with static type inference",

packages/zod/src/v4/classic/compat.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,4 +63,5 @@ export type {
6363
ZodType as Schema,
6464
};
6565

66+
/** Included for Zod 3 compatibility */
6667
export type ZodRawShape = core.$ZodShape;

play.ts

Lines changed: 4 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,6 @@
1-
import * as z from "zod/mini";
1+
import type * as z from "zod";
22

3-
// z.instanceof(URL).check(z.property("hash", z.string().min(10)), z.property("search", z.string().min(10)));
3+
const test = {} as z.ZodObject<z.ZodRawShape>;
4+
const prop: z.core.$ZodType = test.shape.prop;
45

5-
const typeid = z.templateLiteral([z.enum(["a", "b", "c"]), "_", z.string().check(z.regex(/[a-z0-9]{10}/))], {
6-
format: "typeid",
7-
});
8-
console.log(typeid.parse("d_1234567890"));
9-
10-
// throws ZodError ❌
11-
[
12-
{
13-
code: "invalid_format",
14-
format: "typeid",
15-
pattern: "^(a|b|c)_[a-z0-9]{10}$",
16-
path: [],
17-
message: "Invalid typeid",
18-
},
19-
];
20-
21-
// z.file().parse({}).foo;
6+
type MyShape = { readonly [k: string]: z.ZodType };

0 commit comments

Comments
 (0)