import { ControlInput } from './ControlInput'; /** * State validation function * * Takes a Control state object and returns `true` if the state passes validation. If * validation fails, a `ValidationResult` object is returned instead. */ export declare type StateValidationFunction = (state: TState, input: ControlInput) => true | ValidationFailure | Promise; /** * Describes a validation failure. * * Usage: * - A reason code should be provided that uniquely describes the kind of validation * failure. A reason code is useful for context-specific rendering and other business * function. It is not mandatory as for some simple cases it may be duplicative to * provide both a reason code and a single rendering of that reason code. * * - A rendered reason for situations where the rendered form is not context-sensitive and * can be conveniently provided when the ValidationFailure is instantiated. */ export declare type ValidationFailure = { /** * A code representing what validation failed. * * Usage: * - use reasonCode for business logic and transform to a prompt during the rendering * phase. */ reasonCode?: string; /** * A rendered prompt fragment that can be directly included in the `Response`. * * Usage: * - If convenient, generate the prompt fragment at instantiation time. * - A renderedReason should not be used in logic or further transformed. */ renderedReason?: string; }; /** * Helper to evaluate a prop that accepts one or more StateValidationFunction functions. * @param validationProp - either a single StateValidationFunction or an array of * the same. * @param state - The control's state object. * @param input - ControlInput. */ export declare function evaluateValidationProp(validationProp: StateValidationFunction | Array>, state: TState, input: ControlInput): Promise; //# sourceMappingURL=Validation.d.ts.map