export type ObserverCallback = (state: T) => void; export type Keys = (keyof T)[]; export type ActionHandler = (state: T, payload: any) => T; export type Actions = Record>; export type Subscribe = (observer: ObserverCallback, keys?: Keys) => void; export type Unsubscribe = (observer: ObserverCallback) => void; export type Dispatch = (actionKey: A, payload?: any) => T | Promise; export type State = () => T; export interface Store { getState: State; getPrevState: State; subscribe: Subscribe; unsubscribe: Unsubscribe; dispatch: Dispatch; } export interface StoreSettings { actions?: Actions; initialState: T; } export interface Observer { callback: ObserverCallback; keys?: Keys; } export type Observers = Array>; export interface BrowserStorageStoreItem { value: T; expire?: Date; } export interface BrowserStorageStoreSettings extends StoreSettings { key: string; initAction: A; expireInDays?: number; excludeProps?: Keys; }