Vereda
    Preparing search index...

    Function withZod

    • 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

      • T

      Parameters

      • schema: ZodType<T>

      Returns ParseFn<T>

      const UserSchema = z.object({ id: z.number(), name: z.string() });

      const ticket = client.get('/users/1', {
      parse: withZod(UserSchema),
      });