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.
23 lines (22 loc) • 893 B
TypeScript
export interface PropertyData<T> {
/**
* The default value for the property to be used if no value is provided.
*/
readonly defaultValue?: T;
/**
* Defines if the property is optional. If true, the property can be omitted.
* By default, properties are required.
* If property is optional the property will be set to the defaultValue.
*/
readonly isOptional?: boolean;
/**
* Defines if the property should be set to the default value if the value is not parsable.
* By default, the property will throw an error if the value is not parsable.
*/
readonly useDefaultValueOnParseError?: boolean;
/**
* Defines the key in the provided object from which the property should be mapped.
* By default, the property will be mapped from the key with the same name as the property.
*/
readonly mapFrom?: string;
}