import type { Immutable } from "immer"; import { type Dispatch, type ElmOptions, type Message, type UpdateMap, type UseElmishOptions as UseElmishOptionsBase } from "react-elmish/immutable"; import type { UpdateFunction } from "react-elmish/immutable/extend"; interface ElmishStateFunction { init: UseElmishOptionsBase["init"]; update: UpdateFunction; subscription?: UseElmishOptionsBase["subscription"]; } interface ElmishStateMap { init: UseElmishOptionsBase["init"]; update: UpdateMap; subscription?: UseElmishOptionsBase["subscription"]; } type ElmishState = ElmishStateFunction | ElmishStateMap; type UseElmishOptions = Omit, "init" | "update" | "subscription"> & { createState: (dependencies: TDependencies) => ElmishState; }; interface ElmishWithDependencies { useElmish: (options: UseElmishOptions) => [Immutable, Dispatch]; } declare function initWithDependencies(initializationOptions: ElmOptions, dependencies: TDependencies): ElmishWithDependencies; export type { ElmishState, ElmishStateFunction, ElmishStateMap }; export { initWithDependencies };