import { type ValidationContext, type ValidationRule } from '../core'; type Params> = { /** * Условие для выбора ветки */ is: (value: unknown, ctx: ValidationContext) => boolean; /** * Правила валидации, применяемые если is === true */ then: ValidationRule; /** * Правила валидации, применяемые если is === false */ otherwise: ValidationRule; }; /** * Позволяет указывать условные валидации * @example * ```ts * type Values = { name: string; isAgree: boolean }; * * const validate = object({ * name: when({ * is: (_, ctx) => ctx.global.values.isAgree, * then: string(), * otherwise: any(), * }), * isAgree: optional(boolean()), * }); * * // undefined * const result1 = validate({ isAgree: false, name: '' }); * * // Required error для name * const result2 = validate({ isAgree: true, name: '' }); * ``` */ export declare const when: >({ is, then, otherwise, }: Params) => (value: unknown, prevCtx?: ValidationContext | undefined) => ReturnType>; export {};