|
1 | 1 | type t
|
2 | 2 |
|
| 3 | +type usage = [#sort | #search] |
| 4 | +type sensitivity = [#base | #accent | #case | #variant] |
| 5 | +type caseFirst = [#upper | #lower | #"false"] |
| 6 | +type collation = [ |
| 7 | + | #big5han // (Chinese; do not use; not available in Firefox, Chrome or Edge) |
| 8 | + | #compat // (Arabic) |
| 9 | + | #dict // (Sinhala) |
| 10 | + | #direct // (deprecated, do not use) |
| 11 | + | #ducet // (not available, do not use) |
| 12 | + | #emoji // (root) |
| 13 | + | #eor // (root) |
| 14 | + | #gb2312 // (Chinese; do not use; not available in Chrome or Edge) |
| 15 | + | #phonebk // (German) |
| 16 | + | #phonetic // (Lingala) |
| 17 | + | #pinyin // (Chinese) |
| 18 | + | #reformed // (formerly Swedish; do not specify explicitly as this was the old name for the default for Swedish) |
| 19 | + | #searchjl // (Korean; do not use as this is for searching rather than sorting, and the API covers only sorting) |
| 20 | + | #stroke // (Chinese) |
| 21 | + | #trad |
| 22 | + | #unihan // (Chinese, Japanese, and Korean; not available in Chrome or Edge) |
| 23 | + | #zhuyin |
| 24 | +] // (Chinese) |
| 25 | + |
| 26 | +type options = { |
| 27 | + localeMatcher?: Core__Intl__Common.localeMatcher, |
| 28 | + usage?: usage, |
| 29 | + sensitivity?: sensitivity, |
| 30 | + ignorePunctuation?: bool, |
| 31 | + numeric?: bool, |
| 32 | + caseFirst?: caseFirst, |
| 33 | +} |
| 34 | + |
| 35 | +type resolvedOptions = { |
| 36 | + locale: string, |
| 37 | + usage: usage, |
| 38 | + sensitivity: sensitivity, |
| 39 | + ignorePunctuation: bool, |
| 40 | + collation: [collation | #default], |
| 41 | + numeric?: bool, |
| 42 | + caseFirst?: caseFirst, |
| 43 | +} |
| 44 | + |
| 45 | +type supportedLocalesOptions = {localeMatcher: Core__Intl__Common.localeMatcher} |
| 46 | + |
3 | 47 | @new external make: unit => t = "Intl.Collator"
|
4 | 48 | @new external makeWithLocale: string => t = "Intl.Collator"
|
5 | 49 | @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" |
| 50 | +@new external makeWithLocaleAndOptions: (string, options) => t = "Intl.Collator" |
| 51 | +@new external makeWithLocalesAndOptions: (array<string>, options) => t = "Intl.Collator" |
| 52 | +@new external makeWithOptions: (@as(json`undefined`) _, options) => t = "Intl.Collator" |
9 | 53 |
|
10 | 54 | @val external supportedLocalesOf: array<string> => t = "Intl.Collator.supportedLocalesOf"
|
11 | 55 | @val
|
12 |
| -external supportedLocalesOfWithOptions: (array<string>, {..}) => t = |
| 56 | +external supportedLocalesOfWithOptions: (array<string>, supportedLocalesOptions) => t = |
13 | 57 | "Intl.Collator.supportedLocalesOf"
|
14 | 58 |
|
15 |
| -@send external resolvedOptions: t => {..} = "resolvedOptions" |
| 59 | +@send external resolvedOptions: t => resolvedOptions = "resolvedOptions" |
16 | 60 |
|
17 | 61 | @send external compare: (t, string, string) => int = "compare"
|
0 commit comments