Typescript error if trying to combine only one epic ...
See original GitHub issueFirst, thanks for this very neat library !
Here’s a weird error when used with redux-observable … if trying to combineEpics only one epic !
I know combineEpics is useless with only one epic … but if you have 2 epics, and you want to momentary disable one, it shouldn’t be a problem IHMO.
I’ve reproduced the issue based one the example given in the docs : https://deox.js.org/faq#using-redux-observable-with-deox
Here’s my CodeSandbox “fork” : https://codesandbox.io/s/redux-observable-example-4g1lt
The only thing I changed from the given one (https://codesandbox.io/s/redux-observable-example-z6sdk) is to replace combineEpics(fetchAllTodosEpic, addTodoEpic) by combineEpics(addTodoEpic) in todos.ts.
The error then pops all the way in create-store.ts on epicMiddleware.run(rootEpic) :
(alias) const rootEpic: (action$: Observable<{
type: "TODO_ADD_NEXT";
payload: {
title: string;
completed: any;
};
} | {
type: "TODO_ADD_ERROR";
} | {
type: "TODO_ADD_ERROR";
payload: any;
error: true;
} | {
type: "TODO_ADD_ERROR";
payload: any;
} | {
...;
} | {
...;
}>, _state$: Observable<...>, { api }: {
...;
}) => Observable<...>
import rootEpic
L'argument de type '(action$: Observable<{ type: "TODO_ADD_NEXT"; payload: { title: string; completed: any; }; } | { type: "TODO_ADD_ERROR"; } | { type: "TODO_ADD_ERROR"; payload: any; error: true; } | { type: "TODO_ADD_ERROR"; payload: any; } | { ...; } | { ...; }>, _state$: Observable<...>, { api }: { ...; }) => Observable<...>' n'est pas attribuable au paramètre de type 'Epic<Action<any>, Action<any>, void, { api: typeof import("/sandbox/src/store/api"); }>'.
Les types des paramètres '_state$' et 'state$' sont incompatibles.
Impossible d'assigner le type 'StateObservable<void>' au type 'Observable<{ todos: Todo[]; isFetching: boolean; }>'.
Les types de la propriété 'operator' sont incompatibles.
Impossible d'assigner le type 'Operator<any, void>' au type 'Operator<any, { todos: Todo[]; isFetching: boolean; }>'.
Impossible d'assigner le type 'void' au type '{ todos: Todo[]; isFetching: boolean; }'.ts(2345)
Any insight on this ?
Issue Analytics
- State:
- Created 4 years ago
- Comments:6 (3 by maintainers)

Top Related StackOverflow Question
As I said, the error pops in create-store.ts on
epicMiddleware.run(rootEpic):It’s related to redux-observable @creaux. You can follow it on https://github.com/redux-observable/redux-observable/issues/592.