withZod
withZod<
T>(schema):ParseFn<T>
Defined in: src/adapters/zod.ts:15
Wraps a Zod schema into a ParseFn for use with vereda’s parse option.
Uses parseAsync, so schemas with async refinements/transforms work too.
Type Parameters
Section titled “Type Parameters”T
Parameters
Section titled “Parameters”schema
Section titled “schema”ZodType<T>
Returns
Section titled “Returns”ParseFn<T>
Example
Section titled “Example”const UserSchema = z.object({ id: z.number(), name: z.string() });
const ticket = client.get('/users/1', { parse: withZod(UserSchema),});