Giant blob of minor changes
[dotfiles/.git] / .config / coc / extensions / node_modules / coc-tsserver / node_modules / typescript / lib / lib.es2020.intl.d.ts
1 /*! *****************************************************************************
2 Copyright (c) Microsoft Corporation. All rights reserved.
3 Licensed under the Apache License, Version 2.0 (the "License"); you may not use
4 this file except in compliance with the License. You may obtain a copy of the
5 License at http://www.apache.org/licenses/LICENSE-2.0
6
7 THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
8 KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
9 WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
10 MERCHANTABLITY OR NON-INFRINGEMENT.
11
12 See the Apache Version 2.0 License for specific language governing permissions
13 and limitations under the License.
14 ***************************************************************************** */
15
16
17
18 /// <reference no-default-lib="true"/>\r
19
20
21 declare namespace Intl {\r
22 \r
23     /**\r
24      * [BCP 47 language tag](http://tools.ietf.org/html/rfc5646) definition.\r
25      *\r
26      * [MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl#locales_argument).\r
27      *\r
28      * [Wikipedia](https://en.wikipedia.org/wiki/IETF_language_tag).\r
29      */\r
30     type BCP47LanguageTag = string;\r
31 \r
32     /**\r
33      * Unit to use in the relative time internationalized message.\r
34      *\r
35      * [MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/RelativeTimeFormat/format#Parameters).\r
36      *\r
37      * [Specification](https://tc39.es/ecma402/#sec-singularrelativetimeunit).\r
38      */\r
39     type RelativeTimeFormatUnit =\r
40         | "year" | "years"\r
41         | "quarter" | "quarters"\r
42         | "month" | "months"\r
43         | "week" | "weeks"\r
44         | "day" | "days"\r
45         | "hour" | "hours"\r
46         | "minute" | "minutes"\r
47         | "second" | "seconds"\r
48         ;\r
49 \r
50     /**\r
51      * The locale matching algorithm to use.\r
52      *\r
53      * [MDN](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Intl#Locale_negotiation).\r
54      *\r
55      * [Specification](https://tc39.es/ecma402/#sec-InitializeRelativeTimeFormat).\r
56      */\r
57     type RelativeTimeFormatLocaleMatcher = "lookup" | "best fit";\r
58 \r
59     /**\r
60      * The format of output message.\r
61      *\r
62      * [MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/RelativeTimeFormat/RelativeTimeFormat#Parameters).\r
63      *\r
64      * [Specification](https://tc39.es/ecma402/#sec-InitializeRelativeTimeFormat).\r
65      */\r
66     type RelativeTimeFormatNumeric = "always" | "auto";\r
67 \r
68     /**\r
69      * The length of the internationalized message.\r
70      *\r
71      * [MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/RelativeTimeFormat/RelativeTimeFormat#Parameters).\r
72      *\r
73      * [Specification](https://tc39.es/ecma402/#sec-InitializeRelativeTimeFormat).\r
74      */\r
75     type RelativeTimeFormatStyle = "long" | "short" | "narrow";\r
76 \r
77     /**\r
78      * An object with some or all of properties of `options` parameter\r
79      * of `Intl.RelativeTimeFormat` constructor.\r
80      *\r
81      * [MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/RelativeTimeFormat/RelativeTimeFormat#Parameters).\r
82      *\r
83      * [Specification](https://tc39.es/ecma402/#sec-InitializeRelativeTimeFormat).\r
84      */\r
85     interface RelativeTimeFormatOptions {\r
86         localeMatcher?: RelativeTimeFormatLocaleMatcher;\r
87         numeric?: RelativeTimeFormatNumeric;\r
88         style?: RelativeTimeFormatStyle;\r
89     }\r
90 \r
91     /**\r
92      * An object with properties reflecting the locale\r
93      * and formatting options computed during initialization\r
94      * of the `Intel.RelativeTimeFormat` object\r
95      *\r
96      * [MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/RelativeTimeFormat/resolvedOptions#Description).\r
97      *\r
98      * [Specification](https://tc39.es/ecma402/#table-relativetimeformat-resolvedoptions-properties)\r
99      */\r
100     interface ResolvedRelativeTimeFormatOptions {\r
101         locale: BCP47LanguageTag;\r
102         style: RelativeTimeFormatStyle;\r
103         numeric: RelativeTimeFormatNumeric;\r
104         numberingSystem: string;\r
105     }\r
106 \r
107     /**\r
108      * An object representing the relative time format in parts\r
109      * that can be used for custom locale-aware formatting.\r
110      *\r
111      * [MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/RelativeTimeFormat/formatToParts#Using_formatToParts).\r
112      *\r
113      * [Specification](https://tc39.es/ecma402/#sec-FormatRelativeTimeToParts).\r
114      */\r
115     interface RelativeTimeFormatPart {\r
116         type: string;\r
117         value: string;\r
118         unit?: RelativeTimeFormatUnit;\r
119     }\r
120 \r
121     interface RelativeTimeFormat {\r
122         /**\r
123          * Formats a value and a unit according to the locale\r
124          * and formatting options of the given\r
125          * [`Intl.RelativeTimeFormat`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/RelativeTimeFormat)\r
126          * object.\r
127          *\r
128          * While this method automatically provides the correct plural forms,\r
129          * the grammatical form is otherwise as neutral as possible.\r
130          * It is the caller's responsibility to handle cut-off logic\r
131          * such as deciding between displaying "in 7 days" or "in 1 week".\r
132          * This API does not support relative dates involving compound units.\r
133          * e.g "in 5 days and 4 hours".\r
134          *\r
135          * @param value -  Numeric value to use in the internationalized relative time message\r
136          *\r
137          * @param unit - [Unit](https://tc39.es/ecma402/#sec-singularrelativetimeunit)\r
138          *  to use in the relative time internationalized message.\r
139          *  Possible values are: `"year"`, `"quarter"`, `"month"`, `"week"`,\r
140          *  `"day"`, `"hour"`, `"minute"`, `"second"`.\r
141          *  Plural forms are also permitted.\r
142          *\r
143          * @throws `RangeError` if `unit` was given something other than `unit` possible values\r
144          *\r
145          * @returns Internationalized relative time message as string\r
146          *\r
147          * [MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/RelativeTimeFormat/format).\r
148          *\r
149          * [Specification](https://tc39.es/ecma402/#sec-Intl.RelativeTimeFormat.prototype.format).\r
150          */\r
151         format(\r
152             value: number,\r
153             unit: RelativeTimeFormatUnit,\r
154         ): string;\r
155 \r
156         /**\r
157          *  A version of the format method which it returns an array of objects\r
158          *  which represent "parts" of the object,\r
159          *  separating the formatted number into its constituent parts\r
160          *  and separating it from other surrounding text.\r
161          *  These objects have two properties:\r
162          * `type` a NumberFormat formatToParts type, and `value`,\r
163          *  which is the String which is the component of the output.\r
164          *  If a "part" came from NumberFormat,\r
165          *  it will have a unit property which indicates the `unit` being formatted;\r
166          *  literals which are part of the larger frame will not have this property.\r
167          *\r
168          *  @param value - Numeric value to use in the internationalized relative time message\r
169          *\r
170          *  @param unit - [Unit](https://tc39.es/ecma402/#sec-singularrelativetimeunit)\r
171          *   to use in the relative time internationalized message.\r
172          *   Possible values are: `"year"`, `"quarter"`, `"month"`, `"week"`,\r
173          *   `"day"`, `"hour"`, `"minute"`, `"second"`.\r
174          *   Plural forms are also permitted.\r
175          *\r
176          *  @throws `RangeError` if `unit` was given something other than `unit` possible values\r
177          *\r
178          *  @returns Array of [FormatRelativeTimeToParts](https://tc39.es/ecma402/#sec-FormatRelativeTimeToParts)\r
179          *\r
180          *  [MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/RelativeTimeFormat/formatToParts).\r
181          *\r
182          *  [Specification](https://tc39.es/ecma402/#sec-Intl.RelativeTimeFormat.prototype.formatToParts).\r
183          */\r
184         formatToParts(\r
185             value: number,\r
186             unit: RelativeTimeFormatUnit,\r
187         ): RelativeTimeFormatPart[];\r
188 \r
189         /**\r
190          * Provides access to the locale and options computed during initialization of this `Intl.RelativeTimeFormat` object.\r
191          *\r
192          * @returns A new object with properties reflecting the locale\r
193          *  and formatting options computed during initialization\r
194          *  of the `Intel.RelativeTimeFormat` object.\r
195          *\r
196          * [MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/RelativeTimeFormat/resolvedOptions).\r
197          *\r
198          * [Specification](https://tc39.es/ecma402/#sec-intl.relativetimeformat.prototype.resolvedoptions)\r
199          */\r
200         resolvedOptions(): ResolvedRelativeTimeFormatOptions;\r
201     }\r
202 \r
203     /**\r
204      * The [`Intl.RelativeTimeFormat`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/RelativeTimeFormat)\r
205      * object is a constructor for objects that enable language-sensitive relative time formatting.\r
206      *\r
207      * Part of [Intl object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl)\r
208      * namespace and the [ECMAScript Internationalization API](https://www.ecma-international.org/publications/standards/Ecma-402.htm).\r
209      *\r
210      * [Compatibility](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/RelativeTimeFormat#Browser_compatibility).\r
211      *\r
212      * [Polyfills](https://github.com/tc39/proposal-intl-relative-time#polyfills).\r
213      */\r
214     const RelativeTimeFormat: {\r
215         /**\r
216          * Constructor creates [Intl.RelativeTimeFormat](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/RelativeTimeFormat)\r
217          * objects\r
218          *\r
219          * @param locales - A string with a [BCP 47 language tag](http://tools.ietf.org/html/rfc5646), or an array of such strings.\r
220          *  For the general form and interpretation of the locales argument,\r
221          *  see the [`Intl` page](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl#Locale_identification_and_negotiation).\r
222          *\r
223          * @param options - An [object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/RelativeTimeFormat/RelativeTimeFormat#Parameters)\r
224          *  with some or all of options of the formatting.\r
225          *  An object with some or all of the following properties:\r
226          *  - `localeMatcher` - The locale matching algorithm to use.\r
227          *    Possible values are `"lookup"` and `"best fit"`; the default is `"best fit"`.\r
228          *    For information about this option, see [Intl page](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Intl#Locale_negotiation).\r
229          *  - `numeric` - The format of output message.\r
230          *    Possible values are: `"always"` (default, e.g., `1 day ago`) or `"auto"` (e.g., `yesterday`).\r
231          *    The `"auto"` value allows to not always have to use numeric values in the output.\r
232          *  - `style` - The length of the internationalized message. Possible values are:\r
233          *    `"long"` (default, e.g., in 1 month),\r
234          *    `"short"` (e.g., in 1 mo.)\r
235          *    or `"narrow"` (e.g., in 1 mo.). The narrow style could be similar to the short style for some locales.\r
236          *\r
237          * @returns [Intl.RelativeTimeFormat](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/RelativeTimeFormat) object.\r
238          *\r
239          * [MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/RelativeTimeFormat/RelativeTimeFormat).\r
240          *\r
241          * [Specification](https://tc39.es/ecma402/#sec-intl-relativetimeformat-constructor).\r
242          */\r
243         new(\r
244             locales?: BCP47LanguageTag | BCP47LanguageTag[],\r
245             options?: RelativeTimeFormatOptions,\r
246         ): RelativeTimeFormat;\r
247 \r
248         /**\r
249          * Returns an array containing those of the provided locales\r
250          * that are supported in date and time formatting\r
251          * without having to fall back to the runtime's default locale.\r
252          *\r
253          * @param locales - A string with a [BCP 47 language tag](http://tools.ietf.org/html/rfc5646), or an array of such strings.\r
254          *  For the general form and interpretation of the locales argument,\r
255          *  see the [`Intl` page](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl#Locale_identification_and_negotiation).\r
256          *\r
257          * @param options - An [object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/RelativeTimeFormat/RelativeTimeFormat#Parameters)\r
258          *  with some or all of options of the formatting.\r
259          *  An object with some or all of the following properties:\r
260          *  - `localeMatcher` - The locale matching algorithm to use.\r
261          *    Possible values are `"lookup"` and `"best fit"`; the default is `"best fit"`.\r
262          *    For information about this option, see [Intl page](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Intl#Locale_negotiation).\r
263          *  - `numeric` - The format of output message.\r
264          *    Possible values are: `"always"` (default, e.g., `1 day ago`) or `"auto"` (e.g., `yesterday`).\r
265          *    The `"auto"` value allows to not always have to use numeric values in the output.\r
266          *  - `style` - The length of the internationalized message. Possible values are:\r
267          *    `"long"` (default, e.g., in 1 month),\r
268          *    `"short"` (e.g., in 1 mo.)\r
269          *    or `"narrow"` (e.g., in 1 mo.). The narrow style could be similar to the short style for some locales.\r
270          *\r
271          * @returns An array containing those of the provided locales\r
272          *  that are supported in date and time formatting\r
273          *  without having to fall back to the runtime's default locale.\r
274          *\r
275          * [MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/RelativeTimeFormat/supportedLocalesOf).\r
276          *\r
277          * [Specification](https://tc39.es/ecma402/#sec-Intl.RelativeTimeFormat.supportedLocalesOf).\r
278          */\r
279         supportedLocalesOf(\r
280             locales: BCP47LanguageTag | BCP47LanguageTag[],\r
281             options?: RelativeTimeFormatOptions,\r
282         ): BCP47LanguageTag[];\r
283     };\r
284 \r
285     interface NumberFormatOptions {\r
286         compactDisplay?: string;\r
287         notation?: string;\r
288         signDisplay?: string;\r
289         unit?: string;\r
290         unitDisplay?: string;\r
291     }\r
292 \r
293     interface ResolvedNumberFormatOptions {\r
294         compactDisplay?: string;\r
295         notation?: string;\r
296         signDisplay?: string;\r
297         unit?: string;\r
298         unitDisplay?: string;\r
299     }\r
300 }\r