|
2 | 2 | * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. |
3 | 3 | */ |
4 | 4 |
|
5 | | -import { |
6 | | - output, |
7 | | - ZodEffects, |
8 | | - ZodError, |
9 | | - ZodObject, |
10 | | - ZodRawShape, |
11 | | - ZodTypeAny, |
12 | | -} from "zod/v3"; |
| 5 | +import * as z from "zod/v4"; |
| 6 | +import { output, ZodError } from "zod/v4"; |
13 | 7 | import { SDKValidationError } from "../models/errors/sdkvalidationerror.js"; |
14 | 8 | import { ERR, OK, Result } from "../types/fp.js"; |
15 | 9 |
|
@@ -51,21 +45,28 @@ export function safeParse<Inp, Out>( |
51 | 45 | } |
52 | 46 |
|
53 | 47 | export function collectExtraKeys< |
54 | | - Shape extends ZodRawShape, |
55 | | - Catchall extends ZodTypeAny, |
| 48 | + Shape extends z.ZodRawShape, |
| 49 | + Catchall extends z.ZodType, |
56 | 50 | K extends string, |
| 51 | + Optional extends boolean, |
57 | 52 | >( |
58 | | - obj: ZodObject<Shape, "strip", Catchall>, |
| 53 | + obj: z.ZodObject<Shape, z.core.$catchall<Catchall>>, |
59 | 54 | extrasKey: K, |
60 | | - optional: boolean, |
61 | | -): ZodEffects< |
62 | | - typeof obj, |
63 | | - & output<ZodObject<Shape, "strict">> |
64 | | - & { |
65 | | - [k in K]: Record<string, output<Catchall>>; |
66 | | - } |
| 55 | + optional: Optional, |
| 56 | +): z.ZodPipe< |
| 57 | + z.ZodObject<Shape, z.core.$catchall<Catchall>>, |
| 58 | + z.ZodTransform< |
| 59 | + & z.output<z.ZodObject<Shape, z.core.$strip>> |
| 60 | + & (Optional extends true ? { |
| 61 | + [k in K]: Record<string, z.output<Catchall>>; |
| 62 | + } |
| 63 | + : { |
| 64 | + [k in K]?: Record<string, z.output<Catchall>> | undefined; |
| 65 | + }), |
| 66 | + z.output<z.ZodObject<Shape, z.core.$catchall<Catchall>>> |
| 67 | + > |
67 | 68 | > { |
68 | | - return obj.transform((val) => { |
| 69 | + return obj.transform((val: any) => { |
69 | 70 | const extras: Record<string, output<Catchall>> = {}; |
70 | 71 | const { shape } = obj; |
71 | 72 | for (const [key] of Object.entries(val)) { |
|
0 commit comments