massive update, probably broken
[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      * [Unicode BCP 47 Locale Identifiers](https://unicode.org/reports/tr35/#Unicode_Language_and_Locale_Identifiers) 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     type UnicodeBCP47LocaleIdentifier = string;\r
29 \r
30     /**\r
31      * Unit to use in the relative time internationalized message.\r
32      *\r
33      * [MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/RelativeTimeFormat/format#Parameters).\r
34      */\r
35     type RelativeTimeFormatUnit =\r
36         | "year"\r
37         | "years"\r
38         | "quarter"\r
39         | "quarters"\r
40         | "month"\r
41         | "months"\r
42         | "week"\r
43         | "weeks"\r
44         | "day"\r
45         | "days"\r
46         | "hour"\r
47         | "hours"\r
48         | "minute"\r
49         | "minutes"\r
50         | "second"\r
51         | "seconds";\r
52 \r
53     /**\r
54      * The locale matching algorithm to use.\r
55      *\r
56      * [MDN](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Intl#Locale_negotiation).\r
57      */\r
58     type RelativeTimeFormatLocaleMatcher = "lookup" | "best fit";\r
59 \r
60     /**\r
61      * The format of output message.\r
62      *\r
63      * [MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/RelativeTimeFormat/RelativeTimeFormat#Parameters).\r
64      */\r
65     type RelativeTimeFormatNumeric = "always" | "auto";\r
66 \r
67     /**\r
68      * The length of the internationalized message.\r
69      *\r
70      * [MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/RelativeTimeFormat/RelativeTimeFormat#Parameters).\r
71      */\r
72     type RelativeTimeFormatStyle = "long" | "short" | "narrow";\r
73 \r
74     /**\r
75      * [BCP 47 language tag](http://tools.ietf.org/html/rfc5646) definition.\r
76      *\r
77      * [MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl#locales_argument).\r
78      */\r
79     type BCP47LanguageTag = string;\r
80 \r
81     /**\r
82      * An object with some or all of properties of `options` parameter\r
83      * of `Intl.RelativeTimeFormat` constructor.\r
84      *\r
85      * [MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/RelativeTimeFormat/RelativeTimeFormat#Parameters).\r
86      */\r
87     interface RelativeTimeFormatOptions {\r
88         /** The locale matching algorithm to use. For information about this option, see [Intl page](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Intl#Locale_negotiation). */\r
89         localeMatcher?: RelativeTimeFormatLocaleMatcher;\r
90         /** The format of output message. */\r
91         numeric?: RelativeTimeFormatNumeric;\r
92         /** The length of the internationalized message. */\r
93         style?: RelativeTimeFormatStyle;\r
94     }\r
95 \r
96     /**\r
97      * An object with properties reflecting the locale\r
98      * and formatting options computed during initialization\r
99      * of the `Intl.RelativeTimeFormat` object\r
100      *\r
101      * [MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/RelativeTimeFormat/resolvedOptions#Description).\r
102      */\r
103     interface ResolvedRelativeTimeFormatOptions {\r
104         locale: UnicodeBCP47LocaleIdentifier;\r
105         style: RelativeTimeFormatStyle;\r
106         numeric: RelativeTimeFormatNumeric;\r
107         numberingSystem: string;\r
108     }\r
109 \r
110     /**\r
111      * An object representing the relative time format in parts\r
112      * that can be used for custom locale-aware formatting.\r
113      *\r
114      * [MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/RelativeTimeFormat/formatToParts#Using_formatToParts).\r
115      */\r
116     interface RelativeTimeFormatPart {\r
117         type: string;\r
118         value: string;\r
119         unit?: RelativeTimeFormatUnit;\r
120     }\r
121 \r
122     interface RelativeTimeFormat {\r
123         /**\r
124          * Formats a value and a unit according to the locale\r
125          * and formatting options of the given\r
126          * [`Intl.RelativeTimeFormat`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/RelativeTimeFormat)\r
127          * object.\r
128          *\r
129          * While this method automatically provides the correct plural forms,\r
130          * the grammatical form is otherwise as neutral as possible.\r
131          *\r
132          * It is the caller's responsibility to handle cut-off logic\r
133          * such as deciding between displaying "in 7 days" or "in 1 week".\r
134          * This API does not support relative dates involving compound units.\r
135          * e.g "in 5 days and 4 hours".\r
136          *\r
137          * @param value -  Numeric value to use in the internationalized relative time message\r
138          *\r
139          * @param unit - [Unit](https://tc39.es/ecma402/#sec-singularrelativetimeunit) to use in the relative time internationalized message.\r
140          *\r
141          * @throws `RangeError` if `unit` was given something other than `unit` possible values\r
142          *\r
143          * @returns {string} Internationalized relative time message as string\r
144          *\r
145          * [MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/RelativeTimeFormat/format).\r
146          */\r
147         format(value: number, unit: RelativeTimeFormatUnit): string;\r
148 \r
149         /**\r
150          *  Returns an array of objects representing the relative time format in parts that can be used for custom locale-aware formatting.\r
151          *\r
152          *  @param value - Numeric value to use in the internationalized relative time message\r
153          *\r
154          *  @param unit - [Unit](https://tc39.es/ecma402/#sec-singularrelativetimeunit) to use in the relative time internationalized message.\r
155          *\r
156          *  @throws `RangeError` if `unit` was given something other than `unit` possible values\r
157          *\r
158          *  [MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/RelativeTimeFormat/formatToParts).\r
159          */\r
160         formatToParts(value: number, unit: RelativeTimeFormatUnit): RelativeTimeFormatPart[];\r
161 \r
162         /**\r
163          * Provides access to the locale and options computed during initialization of this `Intl.RelativeTimeFormat` object.\r
164          *\r
165          * [MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/RelativeTimeFormat/resolvedOptions).\r
166          */\r
167         resolvedOptions(): ResolvedRelativeTimeFormatOptions;\r
168     }\r
169 \r
170     /**\r
171      * The [`Intl.RelativeTimeFormat`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/RelativeTimeFormat)\r
172      * object is a constructor for objects that enable language-sensitive relative time formatting.\r
173      *\r
174      * [Compatibility](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/RelativeTimeFormat#Browser_compatibility).\r
175      */\r
176     const RelativeTimeFormat: {\r
177         /**\r
178          * Creates [Intl.RelativeTimeFormat](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/RelativeTimeFormat) objects\r
179          *\r
180          * @param locales - A string with a [BCP 47 language tag](http://tools.ietf.org/html/rfc5646), or an array of such strings.\r
181          *  For the general form and interpretation of the locales argument,\r
182          *  see the [`Intl` page](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl#Locale_identification_and_negotiation).\r
183          *\r
184          * @param options - An [object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/RelativeTimeFormat/RelativeTimeFormat#Parameters)\r
185          *  with some or all of options of `RelativeTimeFormatOptions`.\r
186          *\r
187          * @returns [Intl.RelativeTimeFormat](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/RelativeTimeFormat) object.\r
188          *\r
189          * [MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/RelativeTimeFormat/RelativeTimeFormat).\r
190          */\r
191         new(\r
192             locales?: UnicodeBCP47LocaleIdentifier | UnicodeBCP47LocaleIdentifier[],\r
193             options?: RelativeTimeFormatOptions,\r
194         ): RelativeTimeFormat;\r
195 \r
196         /**\r
197          * Returns an array containing those of the provided locales\r
198          * that are supported in date and time formatting\r
199          * without having to fall back to the runtime's default locale.\r
200          *\r
201          * @param locales - A string with a [BCP 47 language tag](http://tools.ietf.org/html/rfc5646), or an array of such strings.\r
202          *  For the general form and interpretation of the locales argument,\r
203          *  see the [`Intl` page](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl#Locale_identification_and_negotiation).\r
204          *\r
205          * @param options - An [object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/RelativeTimeFormat/RelativeTimeFormat#Parameters)\r
206          *  with some or all of options of the formatting.\r
207          *\r
208          * @returns An array containing those of the provided locales\r
209          *  that are supported in date and time formatting\r
210          *  without having to fall back to the runtime's default locale.\r
211          *\r
212          * [MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/RelativeTimeFormat/supportedLocalesOf).\r
213          */\r
214         supportedLocalesOf(\r
215             locales?: UnicodeBCP47LocaleIdentifier | UnicodeBCP47LocaleIdentifier[],\r
216             options?: RelativeTimeFormatOptions,\r
217         ): UnicodeBCP47LocaleIdentifier[];\r
218     };\r
219 \r
220     interface NumberFormatOptions {\r
221         compactDisplay?: "short" | "long" | undefined;\r
222         notation?: "standard" | "scientific" | "engineering" | "compact" | undefined;\r
223         signDisplay?: "auto" | "never" | "always" | undefined;\r
224         unit?: string | undefined;\r
225         unitDisplay?: "short" | "long" | "narrow" | undefined;\r
226     }\r
227 \r
228     interface ResolvedNumberFormatOptions {\r
229         compactDisplay?: "short" | "long";\r
230         notation?: "standard" | "scientific" | "engineering" | "compact";\r
231         signDisplay?: "auto" | "never" | "always";\r
232         unit?: string;\r
233         unitDisplay?: "short" | "long" | "narrow";\r
234     }\r
235 \r
236     interface DateTimeFormatOptions {\r
237         calendar?: string | undefined;\r
238         dayPeriod?: "narrow" | "short" | "long" | undefined;\r
239         numberingSystem?: string | undefined;\r
240 \r
241         dateStyle?: "full" | "long" | "medium" | "short" | undefined;\r
242         timeStyle?: "full" | "long" | "medium" | "short" | undefined;\r
243         hourCycle?: "h11" | "h12" | "h23" | "h24" | undefined;\r
244     }\r
245 \r
246     type LocaleHourCycleKey = "h12" | "h23" | "h11" | "h24";\r
247     type LocaleCollationCaseFirst = "upper" | "lower" | "false";\r
248 \r
249     interface LocaleOptions {\r
250         /** A string containing the language, and the script and region if available. */\r
251         baseName?: string;\r
252         /** The part of the Locale that indicates the locale's calendar era. */\r
253         calendar?: string;\r
254         /** Flag that defines whether case is taken into account for the locale's collation rules. */\r
255         caseFirst?: LocaleCollationCaseFirst;\r
256         /** The collation type used for sorting */\r
257         collation?: string;\r
258         /** The time keeping format convention used by the locale. */\r
259         hourCycle?: LocaleHourCycleKey;\r
260         /** The primary language subtag associated with the locale. */\r
261         language?: string;\r
262         /** The numeral system used by the locale. */\r
263         numberingSystem?: string;\r
264         /** Flag that defines whether the locale has special collation handling for numeric characters. */\r
265         numeric?: boolean;\r
266         /** The region of the world (usually a country) associated with the locale. Possible values are region codes as defined by ISO 3166-1. */\r
267         region?: string;\r
268         /** The script used for writing the particular language used in the locale. Possible values are script codes as defined by ISO 15924. */\r
269         script?: string;\r
270     }\r
271 \r
272     interface Locale extends LocaleOptions {\r
273         /** Gets the most likely values for the language, script, and region of the locale based on existing values. */\r
274         maximize(): Locale;\r
275         /** Attempts to remove information about the locale that would be added by calling `Locale.maximize()`. */\r
276         minimize(): Locale;\r
277         /** Returns the locale's full locale identifier string. */\r
278         toString(): BCP47LanguageTag;\r
279     }\r
280 \r
281     /**\r
282      * Constructor creates [Intl.Locale](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/Locale)\r
283      * objects\r
284      *\r
285      * @param tag - A string with a [BCP 47 language tag](http://tools.ietf.org/html/rfc5646).\r
286      *  For the general form and interpretation of the locales argument,\r
287      *  see the [`Intl` page](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl#Locale_identification_and_negotiation).\r
288      *\r
289      * @param options - An [object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/Locale/Locale#Parameters) with some or all of options of the locale.\r
290      *\r
291      * @returns [Intl.Locale](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/Locale) object.\r
292      *\r
293      * [MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/Locale).\r
294      */\r
295     const Locale: {\r
296         new (tag?: BCP47LanguageTag, options?: LocaleOptions): Locale;\r
297     };\r
298 \r
299      interface DisplayNamesOptions {\r
300         localeMatcher: RelativeTimeFormatLocaleMatcher;\r
301         style: RelativeTimeFormatStyle;\r
302         type: "language" | "region" | "script" | "currency";\r
303         fallback: "code" | "none";\r
304     }\r
305 \r
306     interface DisplayNames {\r
307         /**\r
308          * Receives a code and returns a string based on the locale and options provided when instantiating\r
309          * [`Intl.DisplayNames()`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/DisplayNames)\r
310          *\r
311          * @param code The `code` to provide depends on the `type` passed to display name during creation:\r
312          *  - If the type is `"region"`, code should be either an [ISO-3166 two letters region code](https://www.iso.org/iso-3166-country-codes.html),\r
313          *    or a [three digits UN M49 Geographic Regions](https://unstats.un.org/unsd/methodology/m49/).\r
314          *  - If the type is `"script"`, code should be an [ISO-15924 four letters script code](https://unicode.org/iso15924/iso15924-codes.html).\r
315          *  - If the type is `"language"`, code should be a `languageCode` ["-" `scriptCode`] ["-" `regionCode` ] *("-" `variant` )\r
316          *    subsequence of the unicode_language_id grammar in [UTS 35's Unicode Language and Locale Identifiers grammar](https://unicode.org/reports/tr35/#Unicode_language_identifier).\r
317          *    `languageCode` is either a two letters ISO 639-1 language code or a three letters ISO 639-2 language code.\r
318          *  - If the type is `"currency"`, code should be a [3-letter ISO 4217 currency code](https://www.iso.org/iso-4217-currency-codes.html).\r
319          *\r
320          * [MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/DisplayNames/of).\r
321          */\r
322         of(code: string): string;\r
323         /**\r
324          * Returns a new object with properties reflecting the locale and style formatting options computed during the construction of the current\r
325          * [`Intl/DisplayNames`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/DisplayNames) object.\r
326          *\r
327          * [MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/DisplayNames/resolvedOptions).\r
328          */\r
329         resolvedOptions(): DisplayNamesOptions;\r
330     }\r
331 \r
332     /**\r
333      * The [`Intl.DisplayNames()`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/DisplayNames)\r
334      * object enables the consistent translation of language, region and script display names.\r
335      *\r
336      * [Compatibility](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/DisplayNames#browser_compatibility).\r
337      */\r
338     const DisplayNames: {\r
339         prototype: DisplayNames;\r
340 \r
341         /**\r
342          * @param locales A string with a BCP 47 language tag, or an array of such strings.\r
343          *   For the general form and interpretation of the `locales` argument, see the [Intl](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl#locale_identification_and_negotiation)\r
344          *   page.\r
345          *\r
346          * @param options An object for setting up a display name.\r
347          *\r
348          * [MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/DisplayNames/DisplayNames).\r
349          */\r
350         new(locales?: BCP47LanguageTag | BCP47LanguageTag[], options?: Partial<DisplayNamesOptions>): DisplayNames;\r
351 \r
352         /**\r
353          * Returns an array containing those of the provided locales that are supported in display names without having to fall back to the runtime's default locale.\r
354          *\r
355          * @param locales A string with a BCP 47 language tag, or an array of such strings.\r
356          *   For the general form and interpretation of the `locales` argument, see the [Intl](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl#locale_identification_and_negotiation)\r
357          *   page.\r
358          *\r
359          * @param options An object with a locale matcher.\r
360          *\r
361          * @returns An array of strings representing a subset of the given locale tags that are supported in display names without having to fall back to the runtime's default locale.\r
362          *\r
363          * [MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/DisplayNames/supportedLocalesOf).\r
364          */\r
365         supportedLocalesOf(locales: BCP47LanguageTag | BCP47LanguageTag[], options?: {localeMatcher: RelativeTimeFormatLocaleMatcher}): BCP47LanguageTag[];\r
366     };\r
367 \r
368 }\r