UNPKG

bookish-potato-dto

Version:

## Overview A TypeScript decorators-based API for defining Data Transfer Object (DTO) classes, types, and parsers. Simplifies schema validation and type enforcement using intuitive decorators and TypeScript classes.

15 lines (14 loc) 943 B
import { NumberRange, PropertyData, PropertyParserStrictDataTypes, StringLength } from '../types'; import { ClassType, PrimitiveMap } from '../_types'; interface ArrayLength { readonly minLength?: number; readonly maxLength?: number; } interface PropertyDecoratorArrayData<T extends keyof PrimitiveMap> extends PropertyData<PrimitiveMap[T][]>, PropertyParserStrictDataTypes, ArrayLength { readonly stringsLength?: T extends 'string' ? StringLength : never; readonly numbersRange?: T extends 'number' ? NumberRange : never; } export declare function ArrayProperty<T extends keyof PrimitiveMap>(ofPrimitive: T, data?: PropertyDecoratorArrayData<T>): (target: any, propertyKey: string) => void; type PropertyDecoratorArrayDtoData<T> = PropertyData<T[]> & ArrayLength; export declare function ArrayDtoProperty<T>(ofDto: ClassType<T>, data?: PropertyDecoratorArrayDtoData<T>): (target: any, propertyKey: string) => void; export {};