@stacksjs/ts-validation
Version:
A simple TypeScript starter kit using Bun.
13 lines • 746 B
TypeScript
import { BaseValidator } from './base';
import type { ObjectValidatorType, ValidationNames, ValidationResult, Validator } from '../types';
export declare function object<T extends Record<string, any>>(schema?: Record<string, Validator<any>>): ObjectValidator<T>;
export declare class ObjectValidator<T extends Record<string, any>> extends BaseValidator<T> implements ObjectValidatorType<T> {
name: ValidationNames;
private schema: Record<string, Validator<any>>;
private strictMode: any;
constructor(schema?: Record<string, Validator<any>>);
shape(schema: Record<string, Validator<any>>): this;
strict(strict?: any): this;
custom(validationFn: (value: T) => boolean, message: string): this;
validate(value: T): ValidationResult;
}