export interface TValidator = TBaseValidationContext> { _validationChain: TValidationChain; validate: (cx: GValidationContext) => Promise; append: (validator: TValidator) => TValidator; clone: () => TValidator; push: (...validateFunctions: TValidationLink[]) => void; } export type TValidationChain = TBaseValidationContext> = TValidationLink[]; export interface TValidationLink = TBaseValidationContext> { key: string; validate: TValidateCallback; } export type TValidateCallback = TBaseValidationContext> = (context: GValidationContext) => Promise | void; export interface TBaseValidationContext { config: TValidationContextConfig; value: Readonly; hasError: () => boolean; isValue: (value: unknown) => value is GValue; registerError: (error: TValidationError) => void; } export interface TValidationError { [key: string]: unknown; code: string; message?: string; path?: string; } export interface TValidationContextConfig { name?: string; collectErrorMode: TCollectErrorMode; } export type TCollectErrorMode = 'firstError' | 'all';