Creates a Data Transfer Object (DTO) class with a Zod schema for validation.

Zod raw shape or schema for the DTO.

A DTO class with validation.

  • Creates a Data Transfer Object (DTO) class with a Zod schema for validation.

    Type Parameters

    • T extends ZodType<{ [key: string]: any }, unknown>

    Parameters

    • schema: T

      Zod object schema for the DTO.

    Returns Class<output<T>>

    A DTO class with validation.

  • Creates a Data Transfer Object (DTO) class with a Zod schema for validation.

    Type Parameters

    • T extends Readonly<{ [k: string]: $ZodType<unknown, unknown> }>

    Parameters

    • shape: T

      Zod raw shape for the DTO.

    Returns Class<$InferObjectOutput<T, Record<string, unknown>>>

    A DTO class with validation.