Do you want to request a feature or report a bug?
I hope it is a bug.
What is the current behavior?
import { ActionsObservable } from 'redux-observable'
export const rootEpic = (action$:ActionsObservable<{type:'GET_ALL_PRODUCT'}>) => {
return action$.ofType('GET_ALL_PRODUCT').switchMap(...)
// swithMap is not a recognized method
}
If the current behavior is a bug, please provide the steps to reproduce and if possible a minimal demo of the problem via https://jsbin.com or similar.
What is the expected behavior?
Typescript should recognize switchMap, instead it shows set of methods which don't include any of switchMap, map, filter methods.
Which versions of redux-observable, and which browser and OS are affected by this issue? Did this work in previous versions of redux-observable?
Version 0.17.0
I try it also no 0.16 and 0.15 to no success.
Hey there. 👋 Definitely not a bug.
I’m happy to help if you throw the question up on StackOverflow. Please include a lot more information on how to reproduce, or ideally even a repo that does. Tag it with “redux-observable”
I’ve seen variations of this before many times. Generally speaking the issue is usually either not importing those operators (or all of rxjs) or that you have more than one version of rxjs accidentally installed. Eg v4 and v5, or multiple v5 copies. There are probably variations of these issues as well.
See you on StackOverflow.
Thanks for quick reply on Saturday.
I was just coming to close the issue myself as thank to this repo I found the solution.
I needed this line and it works:
import 'rxjs/add/operator/switchMap';
Woot! So glad you got it fixed. Enjoy your weekend.
I do have
import 'rxjs/add/operator/mergeMap';
and
(action$: ActionsObservable<{ type: 'getApiValue' }>, store) => {
return action$.ofType('getApiValue')
But I can't see anything other than ofType and lift


"redux-observable": "^0.19.0",
"rxjs": "^6.2.1",
@brunolm Hey 👋 your issue is most likely that you're using rxjs v6 with redux-observable 0.19.0 which requires rxjs v5. So what is happening is that two versions of rxjs are being installed and the Observable redux-observable gives you is not the same Observable you're adding the operators to.
You'll need to either backdown your rxjs version to v5 or upgrade redux-observable to one of the 1.0.0 pre-releases which support rxjs v6. right now the latest is 1.0.0-beta.1 and there's a migration guide here
Alternatively since it appears you're using rxjs-compat you may be able to force redux-observable 0.19.0 to use v6 of redux-observable (utilizing the rxjs-compat layer) by overriding the resolver in your bundler. If you're using webpack, it should be something _like_ this, but untested:
// webpack.config.js
module.exports = {
// other config stuff
resolve: {
alias: {
'rxjs': require.resolve('rxjs')
}
}
};
Why this works is because webpack aliases override any sub-dependency version requirements of your direct dependencies (and yours as well, but require.resolve('rxjs') will prefer _your_ dependency version of rxjs).
Let me know if this works for you, I'm interested to know as I could add this to the documentation.
Most helpful comment
@brunolm Hey 👋 your issue is most likely that you're using rxjs v6 with redux-observable 0.19.0 which requires rxjs v5. So what is happening is that two versions of rxjs are being installed and the Observable redux-observable gives you is not the same Observable you're adding the operators to.
You'll need to either backdown your rxjs version to v5 or upgrade redux-observable to one of the 1.0.0 pre-releases which support rxjs v6. right now the latest is 1.0.0-beta.1 and there's a migration guide here