There is a certain code snippet
@Effect()
myEffect$ = this.actions$.pipe(
ofType(MyActions.doSomething),
tap(() => this.store.dispatch(MyActions.doSomething2())),
switchMap(action => {
that is functioning as expected. In order to inject a filter just before the tap, I am looking for a solution that allows switchMap to retain the action value.
My attempt looks like this
@Effect()
myEffect$ = this.actions$.pipe(
ofType(MyActions.doSomething),
switchMap(() => this.store.pipe(select(mySelectors.getAmount), take(1))),
filter(amount => amount <= 0),
tap(() => this.store.dispatch(MyActions.doSomething2())),
switchMap(action => {
....
However, it throws an error saying
property action.xxxx doesn't exist on type number
which is understandable. How can I avoid losing the action value returned by MyActions.doSomething?