import type { CanBeArray, CanBePromise, GetAllObjectPaths, GetPathObjectType } from '@under-control/core'; import type { ValidationError } from './error'; export type ValidatorAttrs = { value: V; }; export type ValidatorResult = CanBePromise>> | CanBePromise; export type GlobalValidator = (attrs: ValidatorAttrs) => ValidatorResult; export type PathValidator> = { path: P; fn: (attrs: ValidatorAttrs> & { globalValue: V; }) => ValidatorResult; }; export type Validator = any> = GlobalValidator | PathValidator;