strict-ts-lib-v5.4 0.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (87) hide show
  1. package/README.md +28 -0
  2. package/libs/decorators/index.d.ts +364 -0
  3. package/libs/decorators/legacy/index.d.ts +19 -0
  4. package/libs/dom/asynciterable/index.d.ts +14 -0
  5. package/libs/dom/index.d.ts +35333 -0
  6. package/libs/dom/iterable/index.d.ts +748 -0
  7. package/libs/es2015/collection/index.d.ts +148 -0
  8. package/libs/es2015/core/index.d.ts +574 -0
  9. package/libs/es2015/generator/index.d.ts +65 -0
  10. package/libs/es2015/index.d.ts +12 -0
  11. package/libs/es2015/iterable/index.d.ts +524 -0
  12. package/libs/es2015/promise/index.d.ts +74 -0
  13. package/libs/es2015/proxy/index.d.ts +131 -0
  14. package/libs/es2015/reflect/index.d.ts +145 -0
  15. package/libs/es2015/symbol/index.d.ts +30 -0
  16. package/libs/es2015/symbol-wellknown/index.d.ts +331 -0
  17. package/libs/es2016/array-include/index.d.ts +115 -0
  18. package/libs/es2016/full/index.d.ts +7 -0
  19. package/libs/es2016/index.d.ts +5 -0
  20. package/libs/es2016/intl/index.d.ts +15 -0
  21. package/libs/es2017/date/index.d.ts +23 -0
  22. package/libs/es2017/full/index.d.ts +7 -0
  23. package/libs/es2017/index.d.ts +9 -0
  24. package/libs/es2017/intl/index.d.ts +28 -0
  25. package/libs/es2017/object/index.d.ts +115 -0
  26. package/libs/es2017/sharedmemory/index.d.ts +244 -0
  27. package/libs/es2017/string/index.d.ts +29 -0
  28. package/libs/es2017/typedarrays/index.d.ts +37 -0
  29. package/libs/es2018/asyncgenerator/index.d.ts +69 -0
  30. package/libs/es2018/asynciterable/index.d.ts +31 -0
  31. package/libs/es2018/full/index.d.ts +8 -0
  32. package/libs/es2018/index.d.ts +8 -0
  33. package/libs/es2018/intl/index.d.ts +103 -0
  34. package/libs/es2018/promise/index.d.ts +14 -0
  35. package/libs/es2018/regexp/index.d.ts +21 -0
  36. package/libs/es2019/array/index.d.ts +94 -0
  37. package/libs/es2019/full/index.d.ts +8 -0
  38. package/libs/es2019/index.d.ts +8 -0
  39. package/libs/es2019/intl/index.d.ts +7 -0
  40. package/libs/es2019/object/index.d.ts +143 -0
  41. package/libs/es2019/string/index.d.ts +21 -0
  42. package/libs/es2019/symbol/index.d.ts +8 -0
  43. package/libs/es2020/bigint/index.d.ts +833 -0
  44. package/libs/es2020/date/index.d.ts +35 -0
  45. package/libs/es2020/full/index.d.ts +8 -0
  46. package/libs/es2020/index.d.ts +11 -0
  47. package/libs/es2020/intl/index.d.ts +473 -0
  48. package/libs/es2020/number/index.d.ts +15 -0
  49. package/libs/es2020/promise/index.d.ts +37 -0
  50. package/libs/es2020/sharedmemory/index.d.ts +119 -0
  51. package/libs/es2020/string/index.d.ts +30 -0
  52. package/libs/es2020/symbol-wellknown/index.d.ts +21 -0
  53. package/libs/es2021/full/index.d.ts +8 -0
  54. package/libs/es2021/index.d.ts +7 -0
  55. package/libs/es2021/intl/index.d.ts +161 -0
  56. package/libs/es2021/promise/index.d.ts +34 -0
  57. package/libs/es2021/string/index.d.ts +20 -0
  58. package/libs/es2021/weakref/index.d.ts +60 -0
  59. package/libs/es2022/array/index.d.ts +105 -0
  60. package/libs/es2022/error/index.d.ts +57 -0
  61. package/libs/es2022/full/index.d.ts +8 -0
  62. package/libs/es2022/index.d.ts +10 -0
  63. package/libs/es2022/intl/index.d.ts +112 -0
  64. package/libs/es2022/object/index.d.ts +41 -0
  65. package/libs/es2022/regexp/index.d.ts +23 -0
  66. package/libs/es2022/sharedmemory/index.d.ts +37 -0
  67. package/libs/es2022/string/index.d.ts +9 -0
  68. package/libs/es2023/array/index.d.ts +906 -0
  69. package/libs/es2023/collection/index.d.ts +5 -0
  70. package/libs/es2023/full/index.d.ts +8 -0
  71. package/libs/es2023/index.d.ts +5 -0
  72. package/libs/es5/index.d.ts +5738 -0
  73. package/libs/es6/index.d.ts +7 -0
  74. package/libs/esnext/collection/index.d.ts +13 -0
  75. package/libs/esnext/decorators/index.d.ts +12 -0
  76. package/libs/esnext/disposable/index.d.ts +169 -0
  77. package/libs/esnext/full/index.d.ts +8 -0
  78. package/libs/esnext/index.d.ts +9 -0
  79. package/libs/esnext/intl/index.d.ts +15 -0
  80. package/libs/esnext/object/index.d.ts +13 -0
  81. package/libs/esnext/promise/index.d.ts +19 -0
  82. package/libs/scripthost/index.d.ts +310 -0
  83. package/libs/webworker/asynciterable/index.d.ts +14 -0
  84. package/libs/webworker/importscripts/index.d.ts +7 -0
  85. package/libs/webworker/index.d.ts +11758 -0
  86. package/libs/webworker/iterable/index.d.ts +543 -0
  87. package/package.json +23 -0
@@ -0,0 +1,35 @@
1
+ /// <reference no-default-lib="true"/>
2
+
3
+ /// <reference lib="es2020.intl" />
4
+
5
+ interface Date {
6
+ /**
7
+ * Converts a date and time to a string by using the current or specified locale.
8
+ * @param locales A locale string, array of locale strings, Intl.Locale object, or array of Intl.Locale objects that contain one or more language or locale tags. If you include more than one locale string, list them in descending order of priority so that the first entry is the preferred locale. If you omit this parameter, the default locale of the JavaScript runtime is used.
9
+ * @param options An object that contains one or more properties that specify comparison options.
10
+ */
11
+ toLocaleString(
12
+ locales?: Intl.LocalesArgument,
13
+ options?: Intl.DateTimeFormatOptions,
14
+ ): string;
15
+
16
+ /**
17
+ * Converts a date to a string by using the current or specified locale.
18
+ * @param locales A locale string, array of locale strings, Intl.Locale object, or array of Intl.Locale objects that contain one or more language or locale tags. If you include more than one locale string, list them in descending order of priority so that the first entry is the preferred locale. If you omit this parameter, the default locale of the JavaScript runtime is used.
19
+ * @param options An object that contains one or more properties that specify comparison options.
20
+ */
21
+ toLocaleDateString(
22
+ locales?: Intl.LocalesArgument,
23
+ options?: Intl.DateTimeFormatOptions,
24
+ ): string;
25
+
26
+ /**
27
+ * Converts a time to a string by using the current or specified locale.
28
+ * @param locales A locale string, array of locale strings, Intl.Locale object, or array of Intl.Locale objects that contain one or more language or locale tags. If you include more than one locale string, list them in descending order of priority so that the first entry is the preferred locale. If you omit this parameter, the default locale of the JavaScript runtime is used.
29
+ * @param options An object that contains one or more properties that specify comparison options.
30
+ */
31
+ toLocaleTimeString(
32
+ locales?: Intl.LocalesArgument,
33
+ options?: Intl.DateTimeFormatOptions,
34
+ ): string;
35
+ }
@@ -0,0 +1,8 @@
1
+ /// <reference no-default-lib="true"/>
2
+
3
+ /// <reference lib="es2020" />
4
+ /// <reference lib="dom" />
5
+ /// <reference lib="webworker.importscripts" />
6
+ /// <reference lib="scripthost" />
7
+ /// <reference lib="dom.iterable" />
8
+ /// <reference lib="dom.asynciterable" />
@@ -0,0 +1,11 @@
1
+ /// <reference no-default-lib="true"/>
2
+
3
+ /// <reference lib="es2019" />
4
+ /// <reference lib="es2020.bigint" />
5
+ /// <reference lib="es2020.date" />
6
+ /// <reference lib="es2020.number" />
7
+ /// <reference lib="es2020.promise" />
8
+ /// <reference lib="es2020.sharedmemory" />
9
+ /// <reference lib="es2020.string" />
10
+ /// <reference lib="es2020.symbol.wellknown" />
11
+ /// <reference lib="es2020.intl" />
@@ -0,0 +1,473 @@
1
+ /// <reference no-default-lib="true"/>
2
+
3
+ /// <reference lib="es2018.intl" />
4
+ declare namespace Intl {
5
+ /**
6
+ * A string that is a valid [Unicode BCP 47 Locale Identifier](https://unicode.org/reports/tr35/#Unicode_locale_identifier).
7
+ *
8
+ * For example: "fa", "es-MX", "zh-Hant-TW".
9
+ *
10
+ * See [MDN - Intl - locales argument](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl#locales_argument).
11
+ */
12
+ type UnicodeBCP47LocaleIdentifier = string;
13
+
14
+ /**
15
+ * Unit to use in the relative time internationalized message.
16
+ *
17
+ * [MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/RelativeTimeFormat/format#Parameters).
18
+ */
19
+ type RelativeTimeFormatUnit =
20
+ | 'year'
21
+ | 'years'
22
+ | 'quarter'
23
+ | 'quarters'
24
+ | 'month'
25
+ | 'months'
26
+ | 'week'
27
+ | 'weeks'
28
+ | 'day'
29
+ | 'days'
30
+ | 'hour'
31
+ | 'hours'
32
+ | 'minute'
33
+ | 'minutes'
34
+ | 'second'
35
+ | 'seconds';
36
+
37
+ /**
38
+ * Value of the `unit` property in objects returned by
39
+ * `Intl.RelativeTimeFormat.prototype.formatToParts()`. `formatToParts` and
40
+ * `format` methods accept either singular or plural unit names as input,
41
+ * but `formatToParts` only outputs singular (e.g. "day") not plural (e.g.
42
+ * "days").
43
+ *
44
+ * [MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/RelativeTimeFormat/formatToParts#Using_formatToParts).
45
+ */
46
+ type RelativeTimeFormatUnitSingular =
47
+ | 'year'
48
+ | 'quarter'
49
+ | 'month'
50
+ | 'week'
51
+ | 'day'
52
+ | 'hour'
53
+ | 'minute'
54
+ | 'second';
55
+
56
+ /**
57
+ * The locale matching algorithm to use.
58
+ *
59
+ * [MDN](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Intl#Locale_negotiation).
60
+ */
61
+ type RelativeTimeFormatLocaleMatcher = 'lookup' | 'best fit';
62
+
63
+ /**
64
+ * The format of output message.
65
+ *
66
+ * [MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/RelativeTimeFormat/RelativeTimeFormat#Parameters).
67
+ */
68
+ type RelativeTimeFormatNumeric = 'always' | 'auto';
69
+
70
+ /**
71
+ * The length of the internationalized message.
72
+ *
73
+ * [MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/RelativeTimeFormat/RelativeTimeFormat#Parameters).
74
+ */
75
+ type RelativeTimeFormatStyle = 'long' | 'short' | 'narrow';
76
+
77
+ /**
78
+ * The locale or locales to use
79
+ *
80
+ * See [MDN - Intl - locales argument](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl#locales_argument).
81
+ */
82
+ type LocalesArgument =
83
+ | UnicodeBCP47LocaleIdentifier
84
+ | Locale
85
+ | readonly (UnicodeBCP47LocaleIdentifier | Locale)[]
86
+ | undefined;
87
+
88
+ /**
89
+ * An object with some or all of properties of `options` parameter
90
+ * of `Intl.RelativeTimeFormat` constructor.
91
+ *
92
+ * [MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/RelativeTimeFormat/RelativeTimeFormat#Parameters).
93
+ */
94
+ interface RelativeTimeFormatOptions {
95
+ /** 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). */
96
+ readonly localeMatcher?: RelativeTimeFormatLocaleMatcher;
97
+ /** The format of output message. */
98
+ readonly numeric?: RelativeTimeFormatNumeric;
99
+ /** The length of the internationalized message. */
100
+ readonly style?: RelativeTimeFormatStyle;
101
+ }
102
+
103
+ /**
104
+ * An object with properties reflecting the locale
105
+ * and formatting options computed during initialization
106
+ * of the `Intl.RelativeTimeFormat` object
107
+ *
108
+ * [MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/RelativeTimeFormat/resolvedOptions#Description).
109
+ */
110
+ interface ResolvedRelativeTimeFormatOptions {
111
+ readonly locale: UnicodeBCP47LocaleIdentifier;
112
+ readonly style: RelativeTimeFormatStyle;
113
+ readonly numeric: RelativeTimeFormatNumeric;
114
+ readonly numberingSystem: string;
115
+ }
116
+
117
+ /**
118
+ * An object representing the relative time format in parts
119
+ * that can be used for custom locale-aware formatting.
120
+ *
121
+ * [MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/RelativeTimeFormat/formatToParts#Using_formatToParts).
122
+ */
123
+ type RelativeTimeFormatPart =
124
+ | {
125
+ readonly type: 'literal';
126
+ readonly value: string;
127
+ }
128
+ | {
129
+ readonly type: Exclude<NumberFormatPartTypes, 'literal'>;
130
+ readonly value: string;
131
+ readonly unit: RelativeTimeFormatUnitSingular;
132
+ };
133
+
134
+ interface RelativeTimeFormat {
135
+ /**
136
+ * Formats a value and a unit according to the locale
137
+ * and formatting options of the given
138
+ * [`Intl.RelativeTimeFormat`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/RelativeTimeFormat)
139
+ * object.
140
+ *
141
+ * While this method automatically provides the correct plural forms,
142
+ * the grammatical form is otherwise as neutral as possible.
143
+ *
144
+ * It is the caller's responsibility to handle cut-off logic
145
+ * such as deciding between displaying "in 7 days" or "in 1 week".
146
+ * This API does not support relative dates involving compound units.
147
+ * e.g "in 5 days and 4 hours".
148
+ *
149
+ * @param value - Numeric value to use in the internationalized relative time message
150
+ *
151
+ * @param unit - [Unit](https://tc39.es/ecma402/#sec-singularrelativetimeunit) to use in the relative time internationalized message.
152
+ *
153
+ * @throws `RangeError` if `unit` was given something other than `unit` possible values
154
+ *
155
+ * @returns {string} Internationalized relative time message as string
156
+ *
157
+ * [MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/RelativeTimeFormat/format).
158
+ */
159
+ format(value: number, unit: RelativeTimeFormatUnit): string;
160
+
161
+ /**
162
+ * Returns an array of objects representing the relative time format in parts that can be used for custom locale-aware formatting.
163
+ *
164
+ * @param value - Numeric value to use in the internationalized relative time message
165
+ *
166
+ * @param unit - [Unit](https://tc39.es/ecma402/#sec-singularrelativetimeunit) to use in the relative time internationalized message.
167
+ *
168
+ * @throws `RangeError` if `unit` was given something other than `unit` possible values
169
+ *
170
+ * [MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/RelativeTimeFormat/formatToParts).
171
+ */
172
+ formatToParts(
173
+ value: number,
174
+ unit: RelativeTimeFormatUnit,
175
+ ): RelativeTimeFormatPart[];
176
+
177
+ /**
178
+ * Provides access to the locale and options computed during initialization of this `Intl.RelativeTimeFormat` object.
179
+ *
180
+ * [MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/RelativeTimeFormat/resolvedOptions).
181
+ */
182
+ resolvedOptions(): ResolvedRelativeTimeFormatOptions;
183
+ }
184
+
185
+ /**
186
+ * The [`Intl.RelativeTimeFormat`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/RelativeTimeFormat)
187
+ * object is a constructor for objects that enable language-sensitive relative time formatting.
188
+ *
189
+ * [Compatibility](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/RelativeTimeFormat#Browser_compatibility).
190
+ */
191
+ const RelativeTimeFormat: {
192
+ /**
193
+ * Creates [Intl.RelativeTimeFormat](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/RelativeTimeFormat) objects
194
+ *
195
+ * @param locales - A string with a [BCP 47 language tag](http://tools.ietf.org/html/rfc5646), or an array of such strings.
196
+ * For the general form and interpretation of the locales argument,
197
+ * see the [`Intl` page](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl#Locale_identification_and_negotiation).
198
+ *
199
+ * @param options - An [object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/RelativeTimeFormat/RelativeTimeFormat#Parameters)
200
+ * with some or all of options of `RelativeTimeFormatOptions`.
201
+ *
202
+ * @returns [Intl.RelativeTimeFormat](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/RelativeTimeFormat) object.
203
+ *
204
+ * [MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/RelativeTimeFormat/RelativeTimeFormat).
205
+ */
206
+ new (
207
+ locales?: LocalesArgument,
208
+ options?: RelativeTimeFormatOptions,
209
+ ): RelativeTimeFormat;
210
+
211
+ /**
212
+ * Returns an array containing those of the provided locales
213
+ * that are supported in date and time formatting
214
+ * without having to fall back to the runtime's default locale.
215
+ *
216
+ * @param locales - A string with a [BCP 47 language tag](http://tools.ietf.org/html/rfc5646), or an array of such strings.
217
+ * For the general form and interpretation of the locales argument,
218
+ * see the [`Intl` page](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl#Locale_identification_and_negotiation).
219
+ *
220
+ * @param options - An [object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/RelativeTimeFormat/RelativeTimeFormat#Parameters)
221
+ * with some or all of options of the formatting.
222
+ *
223
+ * @returns An array containing those of the provided locales
224
+ * that are supported in date and time formatting
225
+ * without having to fall back to the runtime's default locale.
226
+ *
227
+ * [MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/RelativeTimeFormat/supportedLocalesOf).
228
+ */
229
+ supportedLocalesOf(
230
+ locales?: LocalesArgument,
231
+ options?: RelativeTimeFormatOptions,
232
+ ): UnicodeBCP47LocaleIdentifier[];
233
+ };
234
+
235
+ interface NumberFormatOptions {
236
+ readonly compactDisplay?: 'short' | 'long' | undefined;
237
+ readonly notation?:
238
+ | 'standard'
239
+ | 'scientific'
240
+ | 'engineering'
241
+ | 'compact'
242
+ | undefined;
243
+ readonly signDisplay?:
244
+ | 'auto'
245
+ | 'never'
246
+ | 'always'
247
+ | 'exceptZero'
248
+ | undefined;
249
+ readonly unit?: string | undefined;
250
+ readonly unitDisplay?: 'short' | 'long' | 'narrow' | undefined;
251
+ readonly currencyDisplay?: string | undefined;
252
+ readonly currencySign?: string | undefined;
253
+ }
254
+
255
+ interface ResolvedNumberFormatOptions {
256
+ readonly compactDisplay?: 'short' | 'long';
257
+ readonly notation?: 'standard' | 'scientific' | 'engineering' | 'compact';
258
+ readonly signDisplay?: 'auto' | 'never' | 'always' | 'exceptZero';
259
+ readonly unit?: string;
260
+ readonly unitDisplay?: 'short' | 'long' | 'narrow';
261
+ readonly currencyDisplay?: string;
262
+ readonly currencySign?: string;
263
+ }
264
+
265
+ interface DateTimeFormatOptions {
266
+ readonly calendar?: string | undefined;
267
+ readonly dayPeriod?: 'narrow' | 'short' | 'long' | undefined;
268
+ readonly numberingSystem?: string | undefined;
269
+
270
+ readonly dateStyle?: 'full' | 'long' | 'medium' | 'short' | undefined;
271
+ readonly timeStyle?: 'full' | 'long' | 'medium' | 'short' | undefined;
272
+ readonly hourCycle?: 'h11' | 'h12' | 'h23' | 'h24' | undefined;
273
+ }
274
+
275
+ type LocaleHourCycleKey = 'h12' | 'h23' | 'h11' | 'h24';
276
+ type LocaleCollationCaseFirst = 'upper' | 'lower' | 'false';
277
+
278
+ interface LocaleOptions {
279
+ /** A string containing the language, and the script and region if available. */
280
+ readonly baseName?: string;
281
+ /** The part of the Locale that indicates the locale's calendar era. */
282
+ readonly calendar?: string;
283
+ /** Flag that defines whether case is taken into account for the locale's collation rules. */
284
+ readonly caseFirst?: LocaleCollationCaseFirst;
285
+ /** The collation type used for sorting */
286
+ readonly collation?: string;
287
+ /** The time keeping format convention used by the locale. */
288
+ readonly hourCycle?: LocaleHourCycleKey;
289
+ /** The primary language subtag associated with the locale. */
290
+ readonly language?: string;
291
+ /** The numeral system used by the locale. */
292
+ readonly numberingSystem?: string;
293
+ /** Flag that defines whether the locale has special collation handling for numeric characters. */
294
+ readonly numeric?: boolean;
295
+ /** The region of the world (usually a country) associated with the locale. Possible values are region codes as defined by ISO 3166-1. */
296
+ readonly region?: string;
297
+ /** The script used for writing the particular language used in the locale. Possible values are script codes as defined by ISO 15924. */
298
+ readonly script?: string;
299
+ }
300
+
301
+ interface Locale extends LocaleOptions {
302
+ /** A string containing the language, and the script and region if available. */
303
+ readonly baseName: string;
304
+ /** The primary language subtag associated with the locale. */
305
+ readonly language: string;
306
+ /** Gets the most likely values for the language, script, and region of the locale based on existing values. */
307
+ maximize(): Locale;
308
+ /** Attempts to remove information about the locale that would be added by calling `Locale.maximize()`. */
309
+ minimize(): Locale;
310
+ /** Returns the locale's full locale identifier string. */
311
+ toString(): UnicodeBCP47LocaleIdentifier;
312
+ }
313
+
314
+ /**
315
+ * Constructor creates [Intl.Locale](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/Locale)
316
+ * objects
317
+ *
318
+ * @param tag - A string with a [BCP 47 language tag](http://tools.ietf.org/html/rfc5646).
319
+ * For the general form and interpretation of the locales argument,
320
+ * see the [`Intl` page](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl#Locale_identification_and_negotiation).
321
+ *
322
+ * @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.
323
+ *
324
+ * @returns [Intl.Locale](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/Locale) object.
325
+ *
326
+ * [MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/Locale).
327
+ */
328
+ const Locale: {
329
+ new (
330
+ tag: UnicodeBCP47LocaleIdentifier | Locale,
331
+ options?: LocaleOptions,
332
+ ): Locale;
333
+ };
334
+
335
+ type DisplayNamesFallback = 'code' | 'none';
336
+
337
+ type DisplayNamesType =
338
+ | 'language'
339
+ | 'region'
340
+ | 'script'
341
+ | 'calendar'
342
+ | 'dateTimeField'
343
+ | 'currency';
344
+
345
+ type DisplayNamesLanguageDisplay = 'dialect' | 'standard';
346
+
347
+ interface DisplayNamesOptions {
348
+ readonly localeMatcher?: RelativeTimeFormatLocaleMatcher;
349
+ readonly style?: RelativeTimeFormatStyle;
350
+ readonly type: DisplayNamesType;
351
+ readonly languageDisplay?: DisplayNamesLanguageDisplay;
352
+ readonly fallback?: DisplayNamesFallback;
353
+ }
354
+
355
+ interface ResolvedDisplayNamesOptions {
356
+ readonly locale: UnicodeBCP47LocaleIdentifier;
357
+ readonly style: RelativeTimeFormatStyle;
358
+ readonly type: DisplayNamesType;
359
+ readonly fallback: DisplayNamesFallback;
360
+ readonly languageDisplay?: DisplayNamesLanguageDisplay;
361
+ }
362
+
363
+ interface DisplayNames {
364
+ /**
365
+ * Receives a code and returns a string based on the locale and options provided when instantiating
366
+ * [`Intl.DisplayNames()`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/DisplayNames)
367
+ *
368
+ * @param code The `code` to provide depends on the `type` passed to display name during creation:
369
+ * - 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),
370
+ * or a [three digits UN M49 Geographic Regions](https://unstats.un.org/unsd/methodology/m49/).
371
+ * - If the type is `"script"`, code should be an [ISO-15924 four letters script code](https://unicode.org/iso15924/iso15924-codes.html).
372
+ * - If the type is `"language"`, code should be a `languageCode` ["-" `scriptCode`] ["-" `regionCode` ] *("-" `variant` )
373
+ * 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).
374
+ * `languageCode` is either a two letters ISO 639-1 language code or a three letters ISO 639-2 language code.
375
+ * - If the type is `"currency"`, code should be a [3-letter ISO 4217 currency code](https://www.iso.org/iso-4217-currency-codes.html).
376
+ *
377
+ * [MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/DisplayNames/of).
378
+ */
379
+ of(code: string): string | undefined;
380
+ /**
381
+ * Returns a new object with properties reflecting the locale and style formatting options computed during the construction of the current
382
+ * [`Intl/DisplayNames`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/DisplayNames) object.
383
+ *
384
+ * [MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/DisplayNames/resolvedOptions).
385
+ */
386
+ resolvedOptions(): ResolvedDisplayNamesOptions;
387
+ }
388
+
389
+ /**
390
+ * The [`Intl.DisplayNames()`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/DisplayNames)
391
+ * object enables the consistent translation of language, region and script display names.
392
+ *
393
+ * [Compatibility](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/DisplayNames#browser_compatibility).
394
+ */
395
+ const DisplayNames: {
396
+ readonly prototype: DisplayNames;
397
+
398
+ /**
399
+ * @param locales A string with a BCP 47 language tag, or an array of such strings.
400
+ * 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)
401
+ * page.
402
+ *
403
+ * @param options An object for setting up a display name.
404
+ *
405
+ * [MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/DisplayNames/DisplayNames).
406
+ */
407
+ new (locales: LocalesArgument, options: DisplayNamesOptions): DisplayNames;
408
+
409
+ /**
410
+ * 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.
411
+ *
412
+ * @param locales A string with a BCP 47 language tag, or an array of such strings.
413
+ * 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)
414
+ * page.
415
+ *
416
+ * @param options An object with a locale matcher.
417
+ *
418
+ * @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.
419
+ *
420
+ * [MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/DisplayNames/supportedLocalesOf).
421
+ */
422
+ supportedLocalesOf(
423
+ locales?: LocalesArgument,
424
+ options?: { readonly localeMatcher?: RelativeTimeFormatLocaleMatcher },
425
+ ): UnicodeBCP47LocaleIdentifier[];
426
+ };
427
+
428
+ interface CollatorConstructor {
429
+ new (locales?: LocalesArgument, options?: CollatorOptions): Collator;
430
+ (locales?: LocalesArgument, options?: CollatorOptions): Collator;
431
+ supportedLocalesOf(
432
+ locales: LocalesArgument,
433
+ options?: CollatorOptions,
434
+ ): string[];
435
+ }
436
+
437
+ interface DateTimeFormatConstructor {
438
+ new (
439
+ locales?: LocalesArgument,
440
+ options?: DateTimeFormatOptions,
441
+ ): DateTimeFormat;
442
+ (
443
+ locales?: LocalesArgument,
444
+ options?: DateTimeFormatOptions,
445
+ ): DateTimeFormat;
446
+ supportedLocalesOf(
447
+ locales: LocalesArgument,
448
+ options?: DateTimeFormatOptions,
449
+ ): string[];
450
+ }
451
+
452
+ interface NumberFormatConstructor {
453
+ new (
454
+ locales?: LocalesArgument,
455
+ options?: NumberFormatOptions,
456
+ ): NumberFormat;
457
+ (locales?: LocalesArgument, options?: NumberFormatOptions): NumberFormat;
458
+ supportedLocalesOf(
459
+ locales: LocalesArgument,
460
+ options?: NumberFormatOptions,
461
+ ): string[];
462
+ }
463
+
464
+ interface PluralRulesConstructor {
465
+ new (locales?: LocalesArgument, options?: PluralRulesOptions): PluralRules;
466
+ (locales?: LocalesArgument, options?: PluralRulesOptions): PluralRules;
467
+
468
+ supportedLocalesOf(
469
+ locales: LocalesArgument,
470
+ options?: { readonly localeMatcher?: 'lookup' | 'best fit' },
471
+ ): string[];
472
+ }
473
+ }
@@ -0,0 +1,15 @@
1
+ /// <reference no-default-lib="true"/>
2
+
3
+ /// <reference lib="es2020.intl" />
4
+
5
+ interface Number {
6
+ /**
7
+ * Converts a number to a string by using the current or specified locale.
8
+ * @param locales A locale string, array of locale strings, Intl.Locale object, or array of Intl.Locale objects that contain one or more language or locale tags. If you include more than one locale string, list them in descending order of priority so that the first entry is the preferred locale. If you omit this parameter, the default locale of the JavaScript runtime is used.
9
+ * @param options An object that contains one or more properties that specify comparison options.
10
+ */
11
+ toLocaleString(
12
+ locales?: Intl.LocalesArgument,
13
+ options?: Intl.NumberFormatOptions,
14
+ ): string;
15
+ }
@@ -0,0 +1,37 @@
1
+ /// <reference no-default-lib="true"/>
2
+
3
+ interface PromiseFulfilledResult<T> {
4
+ readonly status: 'fulfilled';
5
+ readonly value: T;
6
+ }
7
+
8
+ interface PromiseRejectedResult {
9
+ readonly status: 'rejected';
10
+ readonly reason: unknown;
11
+ }
12
+
13
+ type PromiseSettledResult<T> =
14
+ | PromiseFulfilledResult<T>
15
+ | PromiseRejectedResult;
16
+
17
+ interface PromiseConstructor {
18
+ /**
19
+ * Creates a Promise that is resolved with an array of results when all
20
+ * of the provided Promises resolve or reject.
21
+ * @param values An array of Promises.
22
+ * @returns A new Promise.
23
+ */
24
+ allSettled<T extends readonly unknown[] | readonly []>(
25
+ values: T,
26
+ ): Promise<{ -readonly [P in keyof T]: PromiseSettledResult<Awaited<T[P]>> }>;
27
+
28
+ /**
29
+ * Creates a Promise that is resolved with an array of results when all
30
+ * of the provided Promises resolve or reject.
31
+ * @param values An array of Promises.
32
+ * @returns A new Promise.
33
+ */
34
+ allSettled<T>(
35
+ values: Iterable<T | PromiseLike<T>>,
36
+ ): Promise<PromiseSettledResult<Awaited<T>>[]>;
37
+ }