Decorator composition
It would be nice to encapsulate many decorators into one when their combined use is somewhat frequent.
export const IsCardinal = () => applyDecorators(IsInt(), IsPositive());/** Checks if the value is a positive integer greater than zero. *//** Checks if the value is a positive integer greater than zero. */
export const IsCardinal = (
validationOptions?: ValidationOptions,
): PropertyDecorator =>
applyDecorators(IsInt(validationOptions), IsPositive(validationOptions));@IsCardinal()
id: number;Last updated