UNPKG

ts-valid8

Version:

A next-generation TypeScript validation library with advanced features

37 lines 1.24 kB
import { BaseSchema } from '../core/schema'; import { ValidationContext, ValidationResult } from '../core/types'; /** * BooleanSchema - Boolean value validation with extended functionality */ export declare class BooleanSchema extends BaseSchema<boolean> { _type: string; protected validateType(value: unknown, context: ValidationContext): ValidationResult<boolean>; protected clone(): BooleanSchema; /** * Require the boolean value to be true */ true(message?: string): BooleanSchema; /** * Require the boolean value to be false */ false(message?: string): BooleanSchema; /** * Mark this field as required */ required(message?: string): BooleanSchema; /** * Accept string values and convert them to boolean * 'true', '1', 'yes' will be converted to true * 'false', '0', 'no' will be converted to false */ coerce(): BooleanSchema; /** * Require the boolean to be a specific value (true or false) */ equals(value: boolean, message?: string): BooleanSchema; /** * Apply a custom transformation to the boolean */ transform(fn: (value: boolean) => boolean): BooleanSchema; } //# sourceMappingURL=boolean.d.ts.map