When trying to use createReducer() with redux-saga createSagaMiddleware(), we get the following compilation error in TypeScript 3.8.3:
Argument of type 'SagaMiddleware<object>' is not assignable to parameter of type 'Middleware<EmptyAction<"DECREMENT"> | EmptyAction<"INCREMENT"> | EmptyAction<"SAGA_DECREMENT"> | EmptyAction<"SAGA_INCREMENT">, Readonly<...>>'.
Types of parameters 'api' and 'store' are incompatible.
Type 'Store<EmptyAction<"DECREMENT"> | EmptyAction<"INCREMENT"> | EmptyAction<"SAGA_DECREMENT"> | EmptyAction<"SAGA_INCREMENT">, Readonly<...>>' is not assignable to type 'MiddlewareAPI<Dispatch<AnyAction>, any>'.
The types returned by 'dispatch(...)' are incompatible between these types.
Type 'void' is not assignable to type 'T'. TS2345
What is the current behavior?
When trying to use
createReducer()
with redux-sagacreateSagaMiddleware()
, we get the following compilation error in TypeScript 3.8.3:Demo repo here: http://github.com/rtruong/react-use-redux-saga-issue
What is the expected behavior?
Compiles without errors.
A little about versions:
react-use
: 15.3.4