import type { Draft } from "immer"; import { type UpdateReturnType } from "react-elmish/immutable"; import { type Message, type Model, type Msg as MsgObject, type Options } from "../Form/shared"; import { type ValidationError, type ValidationKey } from "../Validation"; interface Form { /** * Initializes the Form model. */ init: (props: TProps) => Model; /** * Updates the Form model. */ update: (model: Draft & TModel>, msg: Message, props: TProps) => UpdateReturnType>; /** * Object to call Form messages. */ Msg: MsgObject; /** * Gets a validation error for a key. * @param key The key of the error to get. * @param errors The list of errors. * @returns The error for the given key, or null if there is no error. */ getError: (key: TValidationKeys, errors: ValidationError[]) => string | null; } /** * Creates a Form object for the immutable react-elmish API. * @param options Options to pass to the Form. * @returns The created Form object. */ declare function createForm(options: Options): Form; export type { Form }; export { createForm };