The current useCallback accepts a callback type ('input => 'output) as a first argument.
Due to this a function with labeled arguments could not be passed to useCallback.
Instead, if the callback type is generic then function could have labeled arguments
eg:
@module("react")
external useCallback2: ('a, ('b, 'c)) => 'a = "useCallback"
let a = useCallback2((~a, ~b) => a + b, (1, 2))
This would also not cause any issues if we pass anything other than function. Because React does not call the callback function.
Actually we need this change (accept a generic type instead of a callback type) anyway for compatibility with ReScript 11 uncurried mode. As there is no way to express the type “an (uncurried) function of any arity”.