Add default callback to fx.prepend
method
#432
Locked
sergeysova
announced in
Archive
Replies: 2 comments
-
As we artificially forced promise returned by effect to be always handled, I'm suggest to ask jetbrains to allow exceptions for their linting, because changing runtime and introducing additional complexity to just cool down a thing builded to help us is not an optimal way to fix issues |
Beta Was this translation helpful? Give feedback.
0 replies
-
I just write: |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Motivation
Sometimes I need to call effect from my React-components. WebStorm shows me a warning about "unhandled promise" (
Promise returned from myFx is ignored
), because I call effect in event handler, withoutawait
. IDE assumes that promise can be rejected, and in Node.JS environment it can be "unhandled promise rejection" and terminate process, but IDE don't know about that fix in effect source code.Current solution
I creates a new event from effect using
.prepend
with noop callback or identity-callback, but typescript don't like identity-callback if effect has no arguments, alsoprepend
requires to set type for callback argument, that annoying.Suggestion
I suggest to add default callback
arg => arg
and add types for typescript, to allowvoid
params.Beta Was this translation helpful? Give feedback.
All reactions