From 5c5e614f4b2086e416ae8467e30f3ed950a44e31 Mon Sep 17 00:00:00 2001 From: Yanick Champoux Date: Wed, 6 Nov 2019 19:06:54 -0500 Subject: [PATCH] type fixes --- src/buildMiddleware/index.ts | 6 +++--- src/updux.ts | 5 +++-- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/src/buildMiddleware/index.ts b/src/buildMiddleware/index.ts index 4aaceaa..433b0b1 100644 --- a/src/buildMiddleware/index.ts +++ b/src/buildMiddleware/index.ts @@ -1,7 +1,7 @@ import fp from 'lodash/fp'; import { Middleware, MiddlewareAPI, Dispatch } from 'redux'; -import { Dictionary, ActionCreator, Action, UpduxDispatch, UpduxMiddleware } from '../types'; +import { Dictionary, ActionCreator, Action, UpduxDispatch, UpduxMiddleware, UpduxMiddlewareAPI } from '../types'; const MiddlewareFor = (type: any, mw: Middleware ): Middleware => api => next => action => { if (type !== '*' && action.type !== type) return next(action); @@ -20,7 +20,7 @@ function sliceMw( slice: string, mw: Middleware ): Middleware { } function buildMiddleware( - effects : Dictionary>= {}, + effects : Dictionary>= {}, actions : Dictionary= {}, subduxes :any = {}, ): UpduxMiddleware @@ -33,7 +33,7 @@ function buildMiddleware( fp.map( ([ slice, mw ]: [ string, Middleware]) => sliceMw(slice,mw) ) )( subduxes ); - return (api: MiddlewareAPI) => { + return (api: UpduxMiddlewareAPI) => { for (let type in actions) { const ac = actions[type]; diff --git a/src/updux.ts b/src/updux.ts index c3b7d4d..772162c 100644 --- a/src/updux.ts +++ b/src/updux.ts @@ -17,6 +17,7 @@ import { Mutation, Upreducer, UpduxDispatch, + UpduxMiddleware } from './types'; import {Middleware, Store} from 'redux'; @@ -98,7 +99,7 @@ export class Updux { groomMutations: (mutation: Mutation) => Mutation; @observable private localEffects: Dictionary< - Middleware<{}, S, UpduxDispatch> + UpduxMiddleware >; @observable private localActions: Dictionary; @@ -136,7 +137,7 @@ export class Updux { * local updux. The function `getRootState` is provided * alongside `getState` to get the root state. */ - @computed get middleware(): Middleware<{}, S, UpduxDispatch> { + @computed get middleware(): UpduxMiddleware { return buildMiddleware( this.localEffects, this.actions,