@neatau/dto
    Preparing search index...

    Type Alias DTOOptions<T>

    type DTOOptions<T extends ZodType> = {
        schema: T;
        transformError?: (error: ZodError, unsafeData: DTOData<T>) => unknown;
    }

    Type Parameters

    • T extends ZodType
    Index

    Properties

    schema: T

    The Zod schema used to validate the data within the DTO and provide the shape of the data e.g. via getData().

    transformError?: (error: ZodError, unsafeData: DTOData<T>) => unknown

    Transforms an error caught while validating the DTO data into a new error instance. Useful if you want to customize the error handling for your DTOs e.g. by providing your own ValidationError type.

    Type Declaration

      • (error: ZodError, unsafeData: DTOData<T>): unknown
      • Parameters

        • error: ZodError

          The original ZodError instance.

        • unsafeData: DTOData<T>

          The raw input data that failed validation.

        Returns unknown