zustand
Version:
🐻 Bear necessities for state management in React
35 lines (34 loc) • 954 B
TypeScript
import { GetState, SetState, State, StoreApi } from '../vanilla';
declare type DevtoolsType = {
prefix: string;
subscribe: (dispatch: any) => () => void;
unsubscribe: () => void;
send: (action: string, state: any) => void;
init: (state: any) => void;
error: (payload: any) => void;
};
export declare type StoreApiWithRedux<T extends State, A extends {
type: unknown;
}> = StoreApi<T & {
dispatch: (a: A) => A;
}> & {
dispatch: (a: A) => A;
dispatchFromDevtools: boolean;
};
export declare const redux: <S extends object, A extends {
type: unknown;
}>(reducer: (state: S, action: A) => S, initial: S) => (set: SetState<S & {
dispatch: (a: A) => A;
}>, get: GetState<S & {
dispatch: (a: A) => A;
}>, api: StoreApi<S & {
dispatch: (a: A) => A;
}> & {
dispatch: (a: A) => A;
dispatchFromDevtools: boolean;
} & {
devtools?: DevtoolsType;
}) => S & {
dispatch: (a: A) => A;
};
export {};