1 | import { UnsubscribeFunc } from "./types.js";
|
2 | declare type Listener<State> = (state: State) => void;
|
3 | declare type Action<State> = (state: State, ...args: any[]) => Partial<State> | Promise<Partial<State>> | null;
|
4 | declare type BoundAction<State> = (...args: any[]) => void;
|
5 | export declare type Store<State> = {
|
6 | state: State | undefined;
|
7 | action(action: Action<State>): BoundAction<State>;
|
8 | setState(update: Partial<State>, overwrite?: boolean): void;
|
9 | subscribe(listener: Listener<State>): UnsubscribeFunc;
|
10 | };
|
11 | export declare const createStore: <State>(state?: State | undefined) => Store<State>;
|
12 | export {};
|