Closed cknitt closed 8 months ago
I like this, and this is a conversion we should do for more APIs. As in combine variants that can be a single function with optional args now with v11.
We should optimize the compiler to not print the undefineds unless needed. There's an issue for it somewhere and me and @cristianoc have been chatting about it too before.
@zth @illusionalsagacity @glennsl For now I just did it for
Intl.Collator
. If this looks good to you, I would extend it to the other types.
Extended to the remaining Intl
types, please re-review.
Now that we can have functions with optional arguments without a trailing
()
in ReScript 11 uncurried mode, bindings can be simplified to a singlemake
function (and the same forsupportedLocalesOf
) with nice ergonomics.I also think we can drop the distinction between passing a single locale and an array of locales. Just pass an array always.
One minor downside are trailing
undefined
params in the JS output. This is probably something we should improve in the compiler, but it shouldn't do any harm here.@zth @illusionalsagacity @glennsl For now I just did it for
Intl.Collator
. If this looks good to you, I would extend it to the other types.(The first commit just removes duplicate build artifacts that were in
test/intl
plustest/Intl
).