I will add that if you’d like the binding to be curried on the Reason side too (to mimic the original), you could wrap the function from @yawaramin 's example in a small curry2
helper:
[@bs.module "date-fns/fp/closestIndexTo"]
external closestIndexToUncurried: (. array(date)) => (. date) => int = "default";
/* Calling the uncurried binding requires a bit of an awkward syntax: */
let result1 = closestIndexToUncurried(. [|date1, date2|])(. date3);
/* Converts uncurried function of two arguments to a curried function */
type uncurried2('a, 'b, 'c) = (. 'a) => (. 'b) => 'c;
type curried2('a, 'b, 'c) = ('a, 'b) => 'c;
let curry2 = (uncurried2: uncurried2('a, 'b, 'c)): curried2('a, 'b, 'c) => {
(a, b) => uncurried2(. a)(. b);
};
/* New curried closestIndexTo function */
let closestIndexTo = curry2(closestIndexToUncurried);
/* You can now use it as any other Reason function */
let partial1 = closestIndexTo([|date1, date2|]);
let result2 = partial1(date3);
let result3 = closestIndexTo([|date4, date5|], date6);