diff options
Diffstat (limited to 'sdnr/wt/odlux/framework/src/flux/middleware.ts')
-rw-r--r-- | sdnr/wt/odlux/framework/src/flux/middleware.ts | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/sdnr/wt/odlux/framework/src/flux/middleware.ts b/sdnr/wt/odlux/framework/src/flux/middleware.ts index 6179f3bcf..de6505c4f 100644 --- a/sdnr/wt/odlux/framework/src/flux/middleware.ts +++ b/sdnr/wt/odlux/framework/src/flux/middleware.ts @@ -35,7 +35,7 @@ export type ActionHandlerMapObject<S extends { [key: string]: any }, A extends A } export const combineActionHandler = <TState extends { [key: string]: any }, TAction extends Action = Action>(actionHandlers: ActionHandlerMapObject<TState, TAction>) : IActionHandler<TState, TAction> => { - const finalActionHandlers: ActionHandlerMapObject<TState> = {} as ActionHandlerMapObject<TState>; + const finalActionHandlers = {} as { [key: string]: any }; // https://github.com/microsoft/TypeScript/issues/31808 Object.keys(actionHandlers).forEach(actionHandlerKey => { const handler = actionHandlers[actionHandlerKey]; if (typeof handler === 'function') { @@ -55,7 +55,7 @@ export const combineActionHandler = <TState extends { [key: string]: any }, TAct return function combination<TAction extends Action>(state: TState = ({} as TState), action: TAction) { let hasChanged = false; - const nextState : TState = {} as TState; + const nextState = {} as { [key: string]: any }; // https://github.com/microsoft/TypeScript/issues/31808 Object.keys(finalActionHandlers).forEach(key => { const actionHandler = finalActionHandlers[key]; const previousState = state[key]; @@ -76,7 +76,7 @@ export const chainMiddleware = <TStoreState>(...middlewares: Middleware<TStoreSt const middlewareAPI = { getState() { return store.state }, dispatch: <TAction extends Action>(action: TAction) => store.dispatch(action) // we want to use the combinded dispatch - // we should NOT use the flux dispatcher here, since the action would affect ALL stores + // we should NOT use the flux dispatcher here, since the action would affect ALL stores }; const chain = middlewares.map(middleware => middleware(middlewareAPI)); return compose(...chain)(store.dispatch) as Dispatch; |