New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Remove type constraint for Output type of epics #560
Comments
See #446 for the logic behind the current typings
|
Input should be super type of output, since your result action (output) always goes back to your epic input. i.e., to use valid input type, your input type should include output type. |
@DevWurm does that make sense? |
Sorry for the late answer! I understand the reason now and agree. The perfect solution would be to have a type, which described all possible Actions for the Input, but because we didn't find an easy solution for this, I agree with the way you typed it as a middle ground. |
Hey guys, As from index.d.ts#L36-L38
But for the following snippet,
How do we expect to hold the constrain Any help is appreciated. cc: @evertbouw @Ailrun |
I think I don't understand your question. InputType is a union of all of your actions and OutputType is a subset of those actions. If you define action2 to hold a bunch of action1s this constraint still holds. |
Thanks Evert for the prompt reply. Ok this makes sense.
Using the union operator and then while returning using the Code snippet:
Incidentally its close to what Jay suggested here. 😄 |
Having the output extending the input breaks dispatching thunks from an observable (thunks don't extend Action). As thunks should be handled by the thunk middleware before reaching redux-observable middleware, the thunk is not considered input too. Reference: https://stackoverflow.com/a/48512442 (by @jayphelps) |
What is the current behavior?
Currently the Action Output type is constrained to extend the Action Input type of an Epic.
What is the expected behavior?
The Output type should not be constrained, because there is no need to limit the Output actions as far as I see.
The text was updated successfully, but these errors were encountered: