import { type ValidatedBox } from './ValidatedBox.js'; import { type ValidationResult } from './ValidationResult.js'; import { type Validator } from './Validator.js'; import { Variable } from './Variable.js'; /** * Similar to {@link Variable}, except the variable's value can optionally be * validated by a {@link Validator | validator function}. * * @typeParam V - The type of {@link Variable#value}. * @typeParam T - The transformed type of a {@link ValidatedVariable#validValue | valid value}. * * @category State Management */ export declare class ValidatedVariable extends Variable implements ValidatedBox { /** See {@link ValidatedVariable#valid}. For internal use only */ private _valid; /** See {@link ValidatedVariable#validValue}. For internal use only */ private _validValue?; /** * The validator/transformer used for this variable's value. If null, then * the value will always be valid and {@link ValidatedVariable#validValue} * will be equal to {@link Variable#value}. */ readonly validator: Validator | null; constructor(initialValue: V, validator?: Validator | null); get valid(): boolean; get validValue(): T; setValue(value: V, group?: unknown): boolean; validate(value: V): ValidationResult; private validateAndSet; }