import { Struct } from './struct'; /** * A `StructContext` contains information about the current value being * validated as well as helper functions for failures and recursive validating. */ export declare type Context = { value: any; type: string; refinement: string | undefined; branch: Array; path: Array; fail: (props?: Partial) => Failure; check: (value: any, struct: Struct, parent?: any, key?: string | number) => Iterable; }; /** * A `StructFailure` represents a single specific failure in validation. */ export declare type Failure = { value: Context['value']; type: Context['type']; refinement: Context['refinement']; branch: Context['branch']; path: Context['path']; [key: string]: any; }; /** * A type utility to extract the type from a `Struct` class. */ export declare type Infer> = T['TYPE']; /** * A `StructResult` is returned from validation functions. */ export declare type Result = boolean | Iterable; export declare type Coercer = (value: unknown) => unknown; export declare type Validator = (value: unknown, context: Context) => Result; export declare type Refiner = (value: T, context: Context) => Result;