import ValidationError from '../ValidationError'; import { ValidateOptions, Message, InternalOptions, Callback, ExtraParams } from '../types'; import Reference from '../Reference'; import type { AnySchema } from '../schema'; export declare type CreateErrorOptions = { path?: string; message?: Message; params?: ExtraParams; type?: string; }; export declare type TestContext = { path: string; options: ValidateOptions; parent: any; schema: any; resolve: (value: T | Reference) => T; createError: (params?: CreateErrorOptions) => ValidationError; }; export declare type TestFunction = (this: TestContext, value: T, context: TestContext) => boolean | ValidationError | Promise; export declare type TestOptions = { value: any; path?: string; label?: string; options: InternalOptions; originalValue: any; schema: TSchema; sync?: boolean; }; export declare type TestConfig = { name?: string; message?: Message; test: TestFunction; params?: ExtraParams; exclusive?: boolean; }; export declare type Test = ((opts: TestOptions, cb: Callback) => void) & { OPTIONS: TestConfig; }; export default function createValidation(config: { name?: string; test: TestFunction; params?: ExtraParams; message?: Message; }): { = AnySchema>({ value, path, label, options, originalValue, sync, ...rest }: TestOptions, cb: Callback): void; OPTIONS: { name?: string | undefined; test: TestFunction; params?: Record | undefined; message?: string | Record | ((params: any) => unknown) | undefined; }; };