Skip to content

Commit afa7e67

Browse files
committed
3.25.61
1 parent 1c2ad87 commit afa7e67

File tree

2 files changed

+9
-25
lines changed

2 files changed

+9
-25
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": "3.25.60",
3+
"version": "3.25.61",
44
"type": "module",
55
"author": "Colin McDonnell <[email protected]>",
66
"description": "TypeScript-first schema declaration and validation library with static type inference",

play.ts

Lines changed: 8 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,10 @@
11
import { z } from "zod/v4";
22

3-
const enumSchema = z.enum(["a", "b", "c"]);
4-
const nativeEnumSchema = z.nativeEnum(enumSchema.enum);
5-
6-
console.dir(nativeEnumSchema.safeParse("a"), { depth: null }); // Valid
7-
console.dir(nativeEnumSchema.safeParse("d"), { depth: null }); // Throws ZodError
8-
9-
z.file().mime([""]);
10-
11-
// function makeZodObj<const T extends string>(key: T) {
12-
// const a: string = "a";
13-
// const b: string = "b";
14-
// return z.looseObject({
15-
// [a]: z.string(),
16-
// [b]: z.number(),
17-
// });
18-
// }
19-
20-
function makeZodObj<K extends string>(key: K) {
21-
return z.record(z.literal(key), z.string());
22-
}
23-
24-
const schema = makeZodObj("foo");
25-
type schema = z.infer<typeof schema>;
26-
// { foo: string; }
3+
const A = z.string().describe("name");
4+
const B = A.superRefine((val, ctx) => {
5+
ctx.addIssue({
6+
message: `Invalid ${A.description}`,
7+
});
8+
});
9+
10+
B.parse("test"); // Should pass

0 commit comments

Comments
 (0)