@alextheman/utility - v4.3.5
    Preparing search index...

    Function parseZodSchema

    • An alternative function to zodSchema.parse() that can be used to strictly parse Zod schemas.

      Type Parameters

      • Output

        The Zod output type.

      • Input

        The Zod input type.

      • Internals extends $ZodTypeInternals<Output, Input>

        The Zod internal types based on the output and input types.

      • ErrorType extends Error

        The type of error to throw on invalid data.

      Parameters

      • schema: ZodType<Output, Input, Internals>

        The Zod schema to use in parsing.

      • data: unknown

        The data to parse.

      • Optionalerror: ErrorType

        A custom error to throw on invalid data (defaults to DataError).

      Returns output<ZodType<Output, Input, Internals>>

      The parsed data from the Zod schema.

      If the given data cannot be parsed according to the schema.