-
Notifications
You must be signed in to change notification settings - Fork 77
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
Unable to use functions with multiple arguments #27
Comments
It most likely has to do with currying the static member inline onChange(handler: Event -> bool -> unit) =
Interop.mkAttr "onChange" (fun (ev, capture) -> handler ev capture) or if you tolerate tuples in the handler definition static member inline onChange(handler: (Event * bool) -> unit) =
Interop.mkAttr "onChange" handler |
Thanks! I tried both, and now the handler is called, but both params are |
Hmm that's weird, can you try using static member inline onChange(handler: System.Func<Event, bool, unit>) =
Interop.mkAttr "onChange" handler |
Yep, that works fine. But of course makes the signature more noisy. Any idea what's going on? Edit: This also works, so at least there's a user-invisible workaround: static member inline onChange(handler: Event -> ReactElement -> unit) =
Interop.mkAttr "onChange" (System.Func<_,_,_> handler) |
This is just how Fable compiles functions, using |
I see. So using |
I think |
Material-UI contains many
onChange
props where the handler accepts two arguments. However, these functions are never invoked.For example, a prop definition may look like this:
If I remove
bool
from the signature, it works, but of course then the handler doesn't get access to that value.This behaviour seems consistent across all multi-argument functions I've tried. And it works fine when using
Fable.MaterialUI
, which has a DU prop| OnChange of (obj->bool->unit)
.I'm a bit stuck debugging this. Do you have any idea why this could be?
The text was updated successfully, but these errors were encountered: