Skip to content

Commit ccbaa53

Browse files
committed
feat(Intl.PluralRules): strongly typed options
1 parent 55cb16d commit ccbaa53

File tree

1 file changed

+28
-5
lines changed

1 file changed

+28
-5
lines changed

src/intl/Core__Intl__PluralRules.res

Lines changed: 28 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,41 @@
11
type t
22

3+
type options = {
4+
localeMathcer?: [#lookup | #"best fit"],
5+
@as("type") type_?: [#cardinal | #ordinal],
6+
roundingMode?: [
7+
| #ceil
8+
| #floot
9+
| #expand
10+
| #trunc
11+
| #halfCeil
12+
| #halfFloor
13+
| #haldExpand
14+
| #halfTrunc
15+
| #halfEven
16+
],
17+
roundingPriority?: [#auto | #morePrecision | #lessPrecision],
18+
roundingIncrement?: int,
19+
minimumIntegerDigits?: int,
20+
minimumFractionDigits?: int,
21+
maximumFractionDigits?: int,
22+
minimumSignificantDigits?: int,
23+
maximumSignificantDigits?: int,
24+
}
25+
326
@new external make: unit => t = "Intl.PluralRules"
427
@new external makeWithLocale: string => t = "Intl.PluralRules"
528
@new external makeWithLocales: array<string> => t = "Intl.PluralRules"
6-
@new external makeWithLocaleAndOptions: (string, {..}) => t = "Intl.PluralRules"
7-
@new external makeWithLocalesAndOptions: (array<string>, {..}) => t = "Intl.PluralRules"
8-
@new external makeWithOptions: (@as(json`undefined`) _, {..}) => t = "Intl.PluralRules"
29+
@new external makeWithLocaleAndOptions: (string, options) => t = "Intl.PluralRules"
30+
@new external makeWithLocalesAndOptions: (array<string>, options) => t = "Intl.PluralRules"
31+
@new external makeWithOptions: (@as(json`undefined`) _, options) => t = "Intl.PluralRules"
932

1033
@val external supportedLocalesOf: array<string> => t = "Intl.PluralRules.supportedLocalesOf"
1134
@val
12-
external supportedLocalesOfWithOptions: (array<string>, {..}) => t =
35+
external supportedLocalesOfWithOptions: (array<string>, options) => t =
1336
"Intl.PluralRules.supportedLocalesOf"
1437

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

1740
type rule = [#zero | #one | #two | #few | #many | #other]
1841

0 commit comments

Comments
 (0)