UNPKG

@gongt/ts-stl-client

Version:
30 lines (29 loc) 1.15 kB
import { Reducer } from "redux"; import { IAction, IAData, ISingleReducer } from "./action"; export declare type AnyStore = any; export declare type AnyActionData = any; export interface IReducerInfo<T = AnyStore> { callback: ISingleReducer<T, AnyActionData>; actionName: string; storeName: string; global: boolean; } export interface IReducerMap { [actionName: string]: { [storeName: string]: { local: ISingleReducer<AnyStore, AnyActionData>[]; global: ISingleReducer<AnyStore, AnyActionData>[]; }; }; } export interface ISingleReducerChanging<ValueInterface, IData extends IAData> { (part: string, state: ValueInterface, rawAction: IAction<IData>): boolean; displayName?: string; } export interface IReducerMapCombined { [actionName: string]: { [storeName: string]: ISingleReducerChanging<AnyStore, AnyActionData>; }; } export declare function reducerFromNative<T>(native: Reducer<T>): ISingleReducer<T, any>; export declare function MyCombineReducers<AppState, T = keyof AppState>(reducers: IReducerInfo<T>[], toplevel?: Reducer<AppState>): Reducer<AppState>;