// T - Wrapped component props // S - Wrapped component state // K - Store state // I - Injected props to wrapped component export type Listener = (state: K, action?: Action) => void; export type Unsubscribe = () => void; export type Action = (state: K, ...args: any[]) => void; export type BoundAction = (...args: any[]) => void; export interface Store { action(action: Action): BoundAction; setState(update: Pick, overwrite?: boolean, action?: Action): void; subscribe(f: Listener): Unsubscribe; unsubscribe(f: Listener): void; getState(): K; } export default function createStore(state?: K): Store; export type ActionFn = (state: K, ...args: any[]) => Promise> | Partial | void; export interface ActionMap { [actionName: string]: ActionFn; } export type ActionCreator = (store: Store) => ActionMap; export type StateMapper = (state: K, props: T) => I;