the-dr-lazy / deox

Functional Type-safe Flux Standard Utilities
https://deox.js.org
MIT License
206 stars 12 forks source link

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

Closed eXaminator closed 4 years ago

eXaminator commented 4 years ago

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.

the-dr-lazy commented 4 years ago

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

eXaminator commented 4 years ago

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

the-dr-lazy commented 4 years ago

:tada: This issue has been resolved in version 3.2.1 :tada:

The release is available on:

Your semantic-release bot :package::rocket:

the-dr-lazy commented 4 years ago

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

the-dr-lazy commented 4 years ago

:tada: This issue has been resolved in version 3.2.1 :tada:

The release is available on:

Your semantic-release bot :package::rocket:

eXaminator commented 4 years ago

Thank YOU @thebrodmann for fixing it! :)