UNPKG

@loke/ui

Version:
10 lines (9 loc) 432 B
type Machine<S> = { [k: string]: { [j: string]: S; }; }; type MachineState<T> = keyof T; type UnionToIntersection<T> = (T extends any ? (x: T) => any : never) extends (x: infer R) => any ? R : never; export declare function useStateMachine<M>(initialState: MachineState<M>, machine: M & Machine<MachineState<M>>): [keyof M, import("react").ActionDispatch<[event: keyof UnionToIntersection<M[keyof M]>]>]; export {};