-
-
Notifications
You must be signed in to change notification settings - Fork 57
Closed
Description
I'm trying to call a function being passed to me in a Js.t({..})
and it's not being called as I expected.
ReasonML Code:
"onNavigate": (query, event) => props##applyFilter(. query, event),
Function in JS Code side:
applyFilter: (query, event = {}) => {
// snip
};
I think what is happening is the second arg event
is being assigned a default value so when this function is called with a currying style that arg is not set properly.
So now another interesting thing is, when I call the function in a uncurried way:
"onNavigate": (query, event) => props##applyFilter(. query, event),
I get the following warning:
Alert unused: Unused attribute [@u]
Which I believe is a false positive because in this situation the function is now called correctly!
So it seems that there are 2 main issues:
- Default values for function args breaks the currying system (at least when the functions are a property of a JS object)
- When calling a function uncurried, if that function is in a
Js.t({..})
you'll get a warning about an unused attribute[@u]
(playground link)
Metadata
Metadata
Assignees
Labels
No labels