UNPKG

guardz

Version:

A simple and lightweight TypeScript type guard library for runtime type validation.

26 lines (25 loc) 638 B
import { TypeGuardFnConfig } from '../typeguards/isType'; export interface ValidationError { path: string; expectedType: string; actualValue: unknown; message: string; } export interface ValidationTree { valid: boolean; path: string; expectedType?: string; actualValue?: unknown; errors?: ValidationError[]; children?: Record<string, ValidationTree>; } export interface ValidationResult { valid: boolean; errors: ValidationError[]; tree?: ValidationTree; } export interface ValidationContext { path: string; config?: TypeGuardFnConfig | null; parentTree?: ValidationTree; }