@stacksjs/ts-validation
Version:
A simple TypeScript starter kit using Bun.
16 lines • 597 B
TypeScript
import type { ValidationNames, ValidationResult, ValidationRule, Validator } from '../types';
export declare abstract class BaseValidator<T> implements Validator<T> {
protected rules: ValidationRule<T>[];
isRequired: any;
protected fieldName: any;
protected isPartOfShape: any;
name: ValidationNames;
required(): this;
optional(): this;
setIsPartOfShape(isPartOfShape: boolean): this;
setFieldName(fieldName: string): this;
protected addRule(rule: ValidationRule<T>): this;
validate(value: T): ValidationResult;
getRules(): ValidationRule<T>[];
test(value: T): boolean;
}