import { ValidationArguments , ValidatorConstraint , ValidatorConstraintInterface } from 'class-validator' ; @ ValidatorConstraint ( { name : 'isEqualPasswordField' , async : false } ) export class PasswordConfirmValidator implements ValidatorConstraintInterface { defaultMessage ( validationArguments ? ) { return `${ validationArguments . property }" should be equal to "${ validationArguments . constraints [ 0 ] }.` ; } validate ( value , validationArguments ? ) { return value === validationArguments . object [ validationArguments . constraints [ 0 ] ] ; } }