diff --git a/CHANGELOG.md b/CHANGELOG.md index 475761dad0..aae57b1480 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -14,6 +14,8 @@ #### :boom: Breaking Change +- Change `Intl.Collator.compare` return type from `int` to `Ordering.t` (`float`). https://github.com/rescript-lang/rescript/pull/8289 + #### :eyeglasses: Spec Compliance #### :rocket: New Feature diff --git a/packages/@rescript/runtime/Stdlib_Intl_Collator.res b/packages/@rescript/runtime/Stdlib_Intl_Collator.res index 3626e96bc6..a6d0e4a6d7 100644 --- a/packages/@rescript/runtime/Stdlib_Intl_Collator.res +++ b/packages/@rescript/runtime/Stdlib_Intl_Collator.res @@ -77,10 +77,10 @@ Intl.Collator.resolvedOptions(collator).locale == "en-US" ```rescript let collator = Intl.Collator.make(~locales=["en-US"]) -collator->Intl.Collator.compare("apple", "banana") < 0 +Ordering.isLess(collator->Intl.Collator.compare("apple", "banana")) ``` */ -@send external compare: (t, string, string) => int = "compare" +@send external compare: (t, string, string) => Stdlib_Ordering.t = "compare" /** `ignore(collator)` ignores the provided collator and returns unit.