UNPKG

1.28 kBTypeScriptView Raw
1import { DeepPartial, ReducersMapObject, Store } from "redux";
2import { ThunkAction, ThunkDispatch } from "redux-thunk";
3import { IGatsbyState, ActionsUnion, GatsbyStateKeys } from "./types";
4export declare const emitter: import("../utils/mett").IMett;
5export declare const readState: () => IGatsbyState;
6export interface IMultiDispatch {
7 <T extends ActionsUnion | ThunkAction<any, IGatsbyState, any, ActionsUnion>>(action: Array<T>): Array<T>;
8}
9export type GatsbyReduxStore = Store<IGatsbyState> & {
10 dispatch: ThunkDispatch<IGatsbyState, any, ActionsUnion> & IMultiDispatch;
11};
12export declare const configureStore: (initialState: IGatsbyState) => GatsbyReduxStore;
13export declare const store: GatsbyReduxStore;
14/**
15 * Allows overloading some reducers (e.g. when setting a custom datastore)
16 */
17export declare function replaceReducer(customReducers: Partial<ReducersMapObject<IGatsbyState>>): void;
18export declare const saveState: () => void;
19export declare const savePartialStateToDisk: (slices: Array<GatsbyStateKeys>, optionalPrefix?: string, transformState?: (<T extends DeepPartial<IGatsbyState>>(state: T) => T) | undefined) => void;
20export declare const loadPartialStateFromDisk: (slices: Array<GatsbyStateKeys>, optionalPrefix?: string) => DeepPartial<IGatsbyState>;