import { Schema } from '../core/schema'; import { Context } from '../types/SchemaTypes'; import { SchemaError } from '../types/types'; import { BaseRuleConfig, ValidationContext } from './BaseRule'; /** * When test is "false" message appears */ export type RuleBooleanMethod = (value: NonNullable, parent: any, config: ValidationContext) => boolean; /** * When test is "false" message appears */ export type RuleMethodSchemaError = (value: NonNullable, parent: any, config: ValidationContext) => SchemaError[] | true; export type RuleMethod = RuleBooleanMethod | RuleMethodSchemaError; /** * When test is "false" message appears */ export type AsyncRuleBooleanMethod = (value: NonNullable, parent: any, config: ValidationContext) => Promise; /** * When test is "false" message appears */ export type AsyncRuleMethodSchemaError = (value: NonNullable, parent: any, config: ValidationContext) => Promise; export type AsyncRuleMethod = AsyncRuleBooleanMethod | AsyncRuleMethodSchemaError; export type RuleConfig = { isAsync: boolean; isCustomTestThatReturnsArray: boolean; } & BaseRuleConfig<'Rule', Value, T, RuleMethod | AsyncRuleMethod>; export declare function getMethodContext(path: string, validationContext: ValidationContext, parent?: any): ValidationContext; export declare function getRule(config: RuleConfig, context: Context): (value: any, validationContext: ValidationContext) => void; export type OnlyOnTouchRuleConfig = { then: Schema; type: 'OnlyOnTouchRule'; }; export declare function getOnlyTouchRule(config: OnlyOnTouchRuleConfig, context: Context): (value: any, validationContext: ValidationContext) => void;