the-dr-lazy / deox

Functional Type-safe Flux Standard Utilities

Home Page:https://deox.js.org

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

ofType does no longer automatically infer action type from general source in pipe

eXaminator opened this issue · comments

After upgrading to from 2.1.4 to 3.2.0 my epics are broken.

Before the update the ofType operator was able to infer the action type for the following operators in the pipe. It seems this no longer works.

This is the error I get after the update:

image

This is the matching action creator:

image

switchMap should be able to infer the type of the action and thus the types of the payload and meta properties.

Edit: I can also confirm that this works in 3.1.0.

Hi @eXaminator. I tried to repro the issue in CodeSandbox but I wasn't able. What is the type of action$?

I can't test it now, but it might actually be a problem with the type of my action$ observable.

It's also Observable<Action>, but in my case Action is the default type from redux, not the specific action type. I will be able to check that tomorrow when I'm back to work.

But, nevertheless, I actually think it's more correct the "old" way, because before I apply the ofType filter action$ can (and will) contain any action. So I think the behavior of 3.1.0, where ofType automatically infers the correct type based on the given action or action creator is the preferred behavior.

I forked your sandbox and updated it to match my version, which works with 3.1.0: https://codesandbox.io/s/deox141-cu3c6

🎉 This issue has been resolved in version 3.2.1 🎉

The release is available on:

Your semantic-release bot 📦🚀

Now repro works on CodeSandbox. Thank you @eXaminator for reporting this bug.

🎉 This issue has been resolved in version 3.2.1 🎉

The release is available on:

Your semantic-release bot 📦🚀

Thank YOU @thebrodmann for fixing it! :)