Skip to content

Commit 5cde497

Browse files
committed
feat(Intl.RelativeTimeFormat): strongly typed options
1 parent 7d229ef commit 5cde497

File tree

1 file changed

+12
-5
lines changed

1 file changed

+12
-5
lines changed

src/intl/Core__Intl__RelativeTimeFormat.res

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,26 @@
11
type t
22

3+
type options = {
4+
localeMathcer?: [#lookup | #"best fit"],
5+
numberingSystem?: string,
6+
style?: [#long | #short | #narrow],
7+
numeric?: [#always | #auto],
8+
}
9+
310
@new external make: unit => t = "Intl.RelativeTimeFormat"
411
@new external makeWithLocale: string => t = "Intl.RelativeTimeFormat"
512
@new external makeWithLocales: array<string> => t = "Intl.RelativeTimeFormat"
6-
@new external makeWithLocaleAndOptions: (string, {..}) => t = "Intl.RelativeTimeFormat"
7-
@new external makeWithLocalesAndOptions: (array<string>, {..}) => t = "Intl.RelativeTimeFormat"
8-
@new external makeWithOptions: (@as(json`undefined`) _, {..}) => t = "Intl.RelativeTimeFormat"
13+
@new external makeWithLocaleAndOptions: (string, options) => t = "Intl.RelativeTimeFormat"
14+
@new external makeWithLocalesAndOptions: (array<string>, options) => t = "Intl.RelativeTimeFormat"
15+
@new external makeWithOptions: (@as(json`undefined`) _, options) => t = "Intl.RelativeTimeFormat"
916

1017
@val
1118
external supportedLocalesOf: array<string> => t = "Intl.RelativeTimeFormat.supportedLocalesOf"
1219
@val
13-
external supportedLocalesOfWithOptions: (array<string>, {..}) => t =
20+
external supportedLocalesOfWithOptions: (array<string>, options) => t =
1421
"Intl.RelativeTimeFormat.supportedLocalesOf"
1522

16-
@send external resolvedOptions: t => {..} = "resolvedOptions"
23+
@send external resolvedOptions: t => options = "resolvedOptions"
1724

1825
type timeUnit = [#year | #quarter | #month | #week | #day | #hour | #minute | #second]
1926

0 commit comments

Comments
 (0)