stack

Home > @infiniteobjects/data-types > ValidatorConstraintInterface

ValidatorConstraintInterface type

Custom validators must implement this interface to provide custom validation logic.

Signature:

export type ValidatorConstraintInterface<Target = ObjectLike, ValueType = unknown> = {
    validate(value: ValueType, validationArguments?: ValidationArguments<Target>): Promise<boolean> | boolean;
    defaultMessage?(validationArguments?: ValidationArguments<Target>): string;
};

References: ObjectLike, ValidationArguments