import { registerDecorator , ValidationOptions , ValidatorConstraint , ValidatorConstraintInterface , } from 'class-validator' ; @ ValidatorConstraint ( { async : true } ) export class IsListEmptyConstraint implements ValidatorConstraintInterface { validate ( emailList ) { return emailList . length !== 0 ; } } export function IsListEmpty ( validationOptions ? ) { return function ( object , propertyName ) { registerDecorator ( { target : object . constructor , propertyName : propertyName , options : validationOptions , constraints : [ ] , validator : IsListEmptyConstraint , } ) ; } ; }