3

When I have this schema

export const Schema = z
  .object({
    cover_image_path: z.string().nullish(),
  })
  .transform((prev) => ({
    coverImagePath: prev.cover_image_path,
  }));

I can do

Schema.parse(input);

What if I want to do something like

Schema._output.parse(Schema.parse(input));

to avoid declaring another Schema

export const Schema = z
  .object({
    coverImagePath: z.string().nullish(),
  });

Already tried to work with _output but it seems it is just the Output type

Coding Edgar
  • 1,285
  • 1
  • 8
  • 22

0 Answers0