source: trip-planner-front/node_modules/typescript/lib/lib.es2020.intl.d.ts@ 188ee53

Last change on this file since 188ee53 was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago

initial commit

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