Closed paszkowskiDamian closed 5 years ago
Any reason you don't use isActionOf
?
Hey @paszkowskiDamian, thanks for the proposal.
Currently isActionOf
supports an array as parameter to handle a parallel scenario.
So IMO it would be just to extend isOfType
API to also support an array as alternative parameter and API will stay consistent.
I agree and will integrate this change into the API.
Our test suite will also need to be extended with new API cases.
I've opened a new PR #86 implementing new API
@Carl-Foster actaully, I didn't try with isActionOf
but it seems as it is not narrowing action types properly but I didn't researched it why.
action$.pipe(
filter(isActionOf([fetchMoreAccountsFailed, fetchAccountsListFailed])),
mergeMap(async action /*inferes as RootAction*/ => accountsRepository.doSth(action.paylod)),
@issuehuntfest has funded $20.00 to this issue. See it on IssueHunt
@paszkowskidamian has submitted a pull request. See it on IssueHunt
@piotrwitek has rewarded $14.00 to @paszkowskidamian. See it on IssueHunt
Resolved by #86
Is your feature request related to a problem?
Sometimes we have epics that listen for more than one action. It would be really cool if could preserve type-safety of
isOfType
while being able to filter more than one action.Describe a solution you'd like
Who does this impact? Who is this for?
It is for TypeScript users who would like to handle multiple actions using one epic.
Describe alternatives you've considered
We could use
ofType
operator fromredux-observable
but it doesn't return proper types.Additional context
This is my local implementaion:
This could be integrated to already existing
ifOsType
.