Skip to content

Commit 7d229ef

Browse files
committed
feat(Intl.Collator): strongly typed options
1 parent ccbaa53 commit 7d229ef

File tree

1 file changed

+15
-5
lines changed

1 file changed

+15
-5
lines changed

src/intl/Core__Intl__Collator.res

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,27 @@
11
type t
22

3+
type options = {
4+
usage?: [#sort | #search],
5+
localeMathcer?: [#lookup | #"best fit"],
6+
collation?: string,
7+
numeric?: bool,
8+
caseFirst?: [#upper | #lower | #"false"],
9+
sensitivity?: [#base | #accent | #case | #variant],
10+
ignorePunctuation?: bool,
11+
}
12+
313
@new external make: unit => t = "Intl.Collator"
414
@new external makeWithLocale: string => t = "Intl.Collator"
515
@new external makeWithLocales: array<string> => t = "Intl.Collator"
6-
@new external makeWithLocaleAndOptions: (string, {..}) => t = "Intl.Collator"
7-
@new external makeWithLocalesAndOptions: (array<string>, {..}) => t = "Intl.Collator"
8-
@new external makeWithOptions: (@as(json`undefined`) _, {..}) => t = "Intl.Collator"
16+
@new external makeWithLocaleAndOptions: (string, options) => t = "Intl.Collator"
17+
@new external makeWithLocalesAndOptions: (array<string>, options) => t = "Intl.Collator"
18+
@new external makeWithOptions: (@as(json`undefined`) _, options) => t = "Intl.Collator"
919

1020
@val external supportedLocalesOf: array<string> => t = "Intl.Collator.supportedLocalesOf"
1121
@val
12-
external supportedLocalesOfWithOptions: (array<string>, {..}) => t =
22+
external supportedLocalesOfWithOptions: (array<string>, options) => t =
1323
"Intl.Collator.supportedLocalesOf"
1424

15-
@send external resolvedOptions: t => {..} = "resolvedOptions"
25+
@send external resolvedOptions: t => options = "resolvedOptions"
1626

1727
@send external compare: (t, string, string) => int = "compare"

0 commit comments

Comments
 (0)