@stencil/core 2.11.0 → 2.14.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 (65) hide show
  1. package/cli/index.cjs +33 -8
  2. package/cli/index.js +33 -8
  3. package/cli/package.json +1 -1
  4. package/compiler/lib.dom.d.ts +2855 -4909
  5. package/compiler/lib.dom.iterable.d.ts +42 -66
  6. package/compiler/lib.es2015.core.d.ts +60 -18
  7. package/compiler/lib.es2015.iterable.d.ts +3 -11
  8. package/compiler/lib.es2015.promise.d.ts +2 -74
  9. package/compiler/lib.es2015.symbol.wellknown.d.ts +3 -3
  10. package/compiler/lib.es2018.intl.d.ts +23 -11
  11. package/compiler/lib.es2019.string.d.ts +8 -2
  12. package/compiler/lib.es2020.bigint.d.ts +2 -2
  13. package/compiler/lib.es2020.intl.d.ts +173 -114
  14. package/compiler/lib.es2020.promise.d.ts +2 -3
  15. package/compiler/lib.es2021.d.ts +1 -0
  16. package/compiler/lib.es2021.intl.d.ts +44 -0
  17. package/compiler/lib.es2021.promise.d.ts +8 -1
  18. package/compiler/lib.es5.d.ts +112 -52
  19. package/compiler/lib.esnext.intl.d.ts +1 -10
  20. package/compiler/lib.webworker.d.ts +1013 -1267
  21. package/compiler/lib.webworker.iterable.d.ts +28 -34
  22. package/compiler/package.json +1 -1
  23. package/compiler/stencil.js +391 -112
  24. package/compiler/stencil.min.js +2 -2
  25. package/dependencies.json +2 -1
  26. package/dev-server/client/index.js +1 -1
  27. package/dev-server/client/package.json +1 -1
  28. package/dev-server/connector.html +3 -3
  29. package/dev-server/index.js +1 -1
  30. package/dev-server/package.json +1 -1
  31. package/dev-server/server-process.js +16 -5
  32. package/internal/app-data/package.json +1 -1
  33. package/internal/client/css-shim.js +2 -2
  34. package/internal/client/dom.js +1 -1
  35. package/internal/client/index.js +34 -7
  36. package/internal/client/package.json +1 -1
  37. package/internal/client/patch-browser.js +5 -1
  38. package/internal/client/patch-esm.js +1 -1
  39. package/internal/client/polyfills/css-shim.js +1 -1
  40. package/internal/client/shadow-css.js +1 -1
  41. package/internal/hydrate/index.js +2 -1
  42. package/internal/hydrate/package.json +1 -1
  43. package/internal/hydrate/runner.js +1 -1
  44. package/internal/package.json +1 -1
  45. package/internal/stencil-public-runtime.d.ts +6 -4
  46. package/internal/testing/index.js +15 -13
  47. package/internal/testing/package.json +1 -1
  48. package/mock-doc/index.cjs +33 -3
  49. package/mock-doc/index.d.ts +4 -3
  50. package/mock-doc/index.js +33 -3
  51. package/mock-doc/package.json +1 -1
  52. package/package.json +7 -7
  53. package/readme.md +52 -85
  54. package/screenshot/package.json +1 -1
  55. package/sys/node/autoprefixer.js +2 -2
  56. package/sys/node/index.js +22 -18
  57. package/sys/node/package.json +1 -1
  58. package/sys/node/worker.js +1 -1
  59. package/testing/index.js +430 -402
  60. package/testing/jest/jest-config.d.ts +11 -0
  61. package/testing/jest/jest-environment.d.ts +1 -0
  62. package/testing/jest/jest-preprocessor.d.ts +56 -8
  63. package/testing/jest/jest-runner.d.ts +4 -0
  64. package/testing/jest-preset.js +5 -0
  65. package/testing/package.json +1 -1
@@ -24,7 +24,6 @@ declare namespace Intl {
24
24
  * [Unicode BCP 47 Locale Identifiers](https://unicode.org/reports/tr35/#Unicode_Language_and_Locale_Identifiers) definition.
25
25
  *
26
26
  * [MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl#locales_argument).
27
- *
28
27
  */
29
28
  type UnicodeBCP47LocaleIdentifier = string;
30
29
 
@@ -32,26 +31,29 @@ declare namespace Intl {
32
31
  * Unit to use in the relative time internationalized message.
33
32
  *
34
33
  * [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
34
  */
38
35
  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
- ;
36
+ | "year"
37
+ | "years"
38
+ | "quarter"
39
+ | "quarters"
40
+ | "month"
41
+ | "months"
42
+ | "week"
43
+ | "weeks"
44
+ | "day"
45
+ | "days"
46
+ | "hour"
47
+ | "hours"
48
+ | "minute"
49
+ | "minutes"
50
+ | "second"
51
+ | "seconds";
48
52
 
49
53
  /**
50
54
  * The locale matching algorithm to use.
51
55
  *
52
56
  * [MDN](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Intl#Locale_negotiation).
53
- *
54
- * [Specification](https://tc39.es/ecma402/#sec-InitializeRelativeTimeFormat).
55
57
  */
56
58
  type RelativeTimeFormatLocaleMatcher = "lookup" | "best fit";
57
59
 
@@ -59,8 +61,6 @@ declare namespace Intl {
59
61
  * The format of output message.
60
62
  *
61
63
  * [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
64
  */
65
65
  type RelativeTimeFormatNumeric = "always" | "auto";
66
66
 
@@ -68,33 +68,37 @@ declare namespace Intl {
68
68
  * The length of the internationalized message.
69
69
  *
70
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
71
  */
74
72
  type RelativeTimeFormatStyle = "long" | "short" | "narrow";
75
73
 
74
+ /**
75
+ * [BCP 47 language tag](http://tools.ietf.org/html/rfc5646) definition.
76
+ *
77
+ * [MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl#locales_argument).
78
+ */
79
+ type BCP47LanguageTag = string;
80
+
76
81
  /**
77
82
  * An object with some or all of properties of `options` parameter
78
83
  * of `Intl.RelativeTimeFormat` constructor.
79
84
  *
80
85
  * [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
86
  */
84
87
  interface RelativeTimeFormatOptions {
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). */
85
89
  localeMatcher?: RelativeTimeFormatLocaleMatcher;
90
+ /** The format of output message. */
86
91
  numeric?: RelativeTimeFormatNumeric;
92
+ /** The length of the internationalized message. */
87
93
  style?: RelativeTimeFormatStyle;
88
94
  }
89
95
 
90
96
  /**
91
97
  * An object with properties reflecting the locale
92
98
  * and formatting options computed during initialization
93
- * of the `Intel.RelativeTimeFormat` object
99
+ * of the `Intl.RelativeTimeFormat` object
94
100
  *
95
101
  * [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
102
  */
99
103
  interface ResolvedRelativeTimeFormatOptions {
100
104
  locale: UnicodeBCP47LocaleIdentifier;
@@ -108,8 +112,6 @@ declare namespace Intl {
108
112
  * that can be used for custom locale-aware formatting.
109
113
  *
110
114
  * [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
115
  */
114
116
  interface RelativeTimeFormatPart {
115
117
  type: string;
@@ -126,6 +128,7 @@ declare namespace Intl {
126
128
  *
127
129
  * While this method automatically provides the correct plural forms,
128
130
  * the grammatical form is otherwise as neutral as possible.
131
+ *
129
132
  * It is the caller's responsibility to handle cut-off logic
130
133
  * such as deciding between displaying "in 7 days" or "in 1 week".
131
134
  * This API does not support relative dates involving compound units.
@@ -133,68 +136,33 @@ declare namespace Intl {
133
136
  *
134
137
  * @param value - Numeric value to use in the internationalized relative time message
135
138
  *
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.
139
+ * @param unit - [Unit](https://tc39.es/ecma402/#sec-singularrelativetimeunit) to use in the relative time internationalized message.
141
140
  *
142
141
  * @throws `RangeError` if `unit` was given something other than `unit` possible values
143
142
  *
144
- * @returns Internationalized relative time message as string
143
+ * @returns {string} Internationalized relative time message as string
145
144
  *
146
145
  * [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
146
  */
150
- format(
151
- value: number,
152
- unit: RelativeTimeFormatUnit,
153
- ): string;
147
+ format(value: number, unit: RelativeTimeFormatUnit): string;
154
148
 
155
149
  /**
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.
150
+ * Returns an array of objects representing the relative time format in parts that can be used for custom locale-aware formatting.
166
151
  *
167
152
  * @param value - Numeric value to use in the internationalized relative time message
168
153
  *
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.
154
+ * @param unit - [Unit](https://tc39.es/ecma402/#sec-singularrelativetimeunit) to use in the relative time internationalized message.
174
155
  *
175
156
  * @throws `RangeError` if `unit` was given something other than `unit` possible values
176
157
  *
177
- * @returns Array of [FormatRelativeTimeToParts](https://tc39.es/ecma402/#sec-FormatRelativeTimeToParts)
178
- *
179
158
  * [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
159
  */
183
- formatToParts(
184
- value: number,
185
- unit: RelativeTimeFormatUnit,
186
- ): RelativeTimeFormatPart[];
160
+ formatToParts(value: number, unit: RelativeTimeFormatUnit): RelativeTimeFormatPart[];
187
161
 
188
162
  /**
189
163
  * Provides access to the locale and options computed during initialization of this `Intl.RelativeTimeFormat` object.
190
164
  *
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
165
  * [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
166
  */
199
167
  resolvedOptions(): ResolvedRelativeTimeFormatOptions;
200
168
  }
@@ -203,41 +171,22 @@ declare namespace Intl {
203
171
  * The [`Intl.RelativeTimeFormat`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/RelativeTimeFormat)
204
172
  * object is a constructor for objects that enable language-sensitive relative time formatting.
205
173
  *
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
174
  * [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
175
  */
213
176
  const RelativeTimeFormat: {
214
177
  /**
215
- * Constructor creates [Intl.RelativeTimeFormat](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/RelativeTimeFormat)
216
- * objects
178
+ * Creates [Intl.RelativeTimeFormat](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/RelativeTimeFormat) objects
217
179
  *
218
180
  * @param locales - A string with a [BCP 47 language tag](http://tools.ietf.org/html/rfc5646), or an array of such strings.
219
181
  * For the general form and interpretation of the locales argument,
220
182
  * see the [`Intl` page](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl#Locale_identification_and_negotiation).
221
183
  *
222
184
  * @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.
185
+ * with some or all of options of `RelativeTimeFormatOptions`.
235
186
  *
236
187
  * @returns [Intl.RelativeTimeFormat](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/RelativeTimeFormat) object.
237
188
  *
238
189
  * [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
190
  */
242
191
  new(
243
192
  locales?: UnicodeBCP47LocaleIdentifier | UnicodeBCP47LocaleIdentifier[],
@@ -255,25 +204,12 @@ declare namespace Intl {
255
204
  *
256
205
  * @param options - An [object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/RelativeTimeFormat/RelativeTimeFormat#Parameters)
257
206
  * 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
207
  *
270
208
  * @returns An array containing those of the provided locales
271
209
  * that are supported in date and time formatting
272
210
  * without having to fall back to the runtime's default locale.
273
211
  *
274
212
  * [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
213
  */
278
214
  supportedLocalesOf(
279
215
  locales?: UnicodeBCP47LocaleIdentifier | UnicodeBCP47LocaleIdentifier[],
@@ -282,28 +218,151 @@ declare namespace Intl {
282
218
  };
283
219
 
284
220
  interface NumberFormatOptions {
285
- compactDisplay?: string;
286
- notation?: string;
287
- signDisplay?: string;
288
- unit?: string;
289
- unitDisplay?: string;
221
+ compactDisplay?: "short" | "long" | undefined;
222
+ notation?: "standard" | "scientific" | "engineering" | "compact" | undefined;
223
+ signDisplay?: "auto" | "never" | "always" | undefined;
224
+ unit?: string | undefined;
225
+ unitDisplay?: "short" | "long" | "narrow" | undefined;
290
226
  }
291
227
 
292
228
  interface ResolvedNumberFormatOptions {
293
- compactDisplay?: string;
294
- notation?: string;
295
- signDisplay?: string;
229
+ compactDisplay?: "short" | "long";
230
+ notation?: "standard" | "scientific" | "engineering" | "compact";
231
+ signDisplay?: "auto" | "never" | "always";
296
232
  unit?: string;
297
- unitDisplay?: string;
233
+ unitDisplay?: "short" | "long" | "narrow";
298
234
  }
299
235
 
300
236
  interface DateTimeFormatOptions {
301
- dateStyle?: "full" | "long" | "medium" | "short";
302
- timeStyle?: "full" | "long" | "medium" | "short";
237
+ calendar?: string | undefined;
238
+ dayPeriod?: "narrow" | "short" | "long" | undefined;
239
+ numberingSystem?: string | undefined;
240
+
241
+ dateStyle?: "full" | "long" | "medium" | "short" | undefined;
242
+ timeStyle?: "full" | "long" | "medium" | "short" | undefined;
243
+ hourCycle?: "h11" | "h12" | "h23" | "h24" | undefined;
244
+ }
245
+
246
+ type LocaleHourCycleKey = "h12" | "h23" | "h11" | "h24";
247
+ type LocaleCollationCaseFirst = "upper" | "lower" | "false";
248
+
249
+ interface LocaleOptions {
250
+ /** A string containing the language, and the script and region if available. */
251
+ baseName?: string;
252
+ /** The part of the Locale that indicates the locale's calendar era. */
303
253
  calendar?: string;
304
- dayPeriod?: "narrow" | "short" | "long";
254
+ /** Flag that defines whether case is taken into account for the locale's collation rules. */
255
+ caseFirst?: LocaleCollationCaseFirst;
256
+ /** The collation type used for sorting */
257
+ collation?: string;
258
+ /** The time keeping format convention used by the locale. */
259
+ hourCycle?: LocaleHourCycleKey;
260
+ /** The primary language subtag associated with the locale. */
261
+ language?: string;
262
+ /** The numeral system used by the locale. */
305
263
  numberingSystem?: string;
306
- hourCycle?: "h11" | "h12" | "h23" | "h24";
307
- fractionalSecondDigits?: 0 | 1 | 2 | 3;
264
+ /** Flag that defines whether the locale has special collation handling for numeric characters. */
265
+ numeric?: boolean;
266
+ /** The region of the world (usually a country) associated with the locale. Possible values are region codes as defined by ISO 3166-1. */
267
+ region?: string;
268
+ /** The script used for writing the particular language used in the locale. Possible values are script codes as defined by ISO 15924. */
269
+ script?: string;
270
+ }
271
+
272
+ interface Locale extends LocaleOptions {
273
+ /** Gets the most likely values for the language, script, and region of the locale based on existing values. */
274
+ maximize(): Locale;
275
+ /** Attempts to remove information about the locale that would be added by calling `Locale.maximize()`. */
276
+ minimize(): Locale;
277
+ /** Returns the locale's full locale identifier string. */
278
+ toString(): BCP47LanguageTag;
308
279
  }
280
+
281
+ /**
282
+ * Constructor creates [Intl.Locale](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/Locale)
283
+ * objects
284
+ *
285
+ * @param tag - A string with a [BCP 47 language tag](http://tools.ietf.org/html/rfc5646).
286
+ * For the general form and interpretation of the locales argument,
287
+ * see the [`Intl` page](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl#Locale_identification_and_negotiation).
288
+ *
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.
290
+ *
291
+ * @returns [Intl.Locale](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/Locale) object.
292
+ *
293
+ * [MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/Locale).
294
+ */
295
+ const Locale: {
296
+ new (tag?: BCP47LanguageTag, options?: LocaleOptions): Locale;
297
+ };
298
+
299
+ interface DisplayNamesOptions {
300
+ localeMatcher: RelativeTimeFormatLocaleMatcher;
301
+ style: RelativeTimeFormatStyle;
302
+ type: "language" | "region" | "script" | "currency";
303
+ fallback: "code" | "none";
304
+ }
305
+
306
+ interface DisplayNames {
307
+ /**
308
+ * Receives a code and returns a string based on the locale and options provided when instantiating
309
+ * [`Intl.DisplayNames()`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/DisplayNames)
310
+ *
311
+ * @param code The `code` to provide depends on the `type` passed to display name during creation:
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),
313
+ * or a [three digits UN M49 Geographic Regions](https://unstats.un.org/unsd/methodology/m49/).
314
+ * - If the type is `"script"`, code should be an [ISO-15924 four letters script code](https://unicode.org/iso15924/iso15924-codes.html).
315
+ * - If the type is `"language"`, code should be a `languageCode` ["-" `scriptCode`] ["-" `regionCode` ] *("-" `variant` )
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).
317
+ * `languageCode` is either a two letters ISO 639-1 language code or a three letters ISO 639-2 language code.
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).
319
+ *
320
+ * [MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/DisplayNames/of).
321
+ */
322
+ of(code: string): string;
323
+ /**
324
+ * Returns a new object with properties reflecting the locale and style formatting options computed during the construction of the current
325
+ * [`Intl/DisplayNames`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/DisplayNames) object.
326
+ *
327
+ * [MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/DisplayNames/resolvedOptions).
328
+ */
329
+ resolvedOptions(): DisplayNamesOptions;
330
+ }
331
+
332
+ /**
333
+ * The [`Intl.DisplayNames()`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/DisplayNames)
334
+ * object enables the consistent translation of language, region and script display names.
335
+ *
336
+ * [Compatibility](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/DisplayNames#browser_compatibility).
337
+ */
338
+ const DisplayNames: {
339
+ prototype: DisplayNames;
340
+
341
+ /**
342
+ * @param locales A string with a BCP 47 language tag, or an array of such strings.
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)
344
+ * page.
345
+ *
346
+ * @param options An object for setting up a display name.
347
+ *
348
+ * [MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/DisplayNames/DisplayNames).
349
+ */
350
+ new(locales?: BCP47LanguageTag | BCP47LanguageTag[], options?: Partial<DisplayNamesOptions>): DisplayNames;
351
+
352
+ /**
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.
354
+ *
355
+ * @param locales A string with a BCP 47 language tag, or an array of such strings.
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)
357
+ * page.
358
+ *
359
+ * @param options An object with a locale matcher.
360
+ *
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.
362
+ *
363
+ * [MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/DisplayNames/supportedLocalesOf).
364
+ */
365
+ supportedLocalesOf(locales: BCP47LanguageTag | BCP47LanguageTag[], options?: {localeMatcher: RelativeTimeFormatLocaleMatcher}): BCP47LanguageTag[];
366
+ };
367
+
309
368
  }
@@ -37,8 +37,7 @@ interface PromiseConstructor {
37
37
  * @param values An array of Promises.
38
38
  * @returns A new Promise.
39
39
  */
40
- allSettled<T extends readonly unknown[] | readonly [unknown]>(values: T):
41
- Promise<{ -readonly [P in keyof T]: PromiseSettledResult<T[P] extends PromiseLike<infer U> ? U : T[P]> }>;
40
+ allSettled<T extends readonly unknown[] | []>(values: T): Promise<{ -readonly [P in keyof T]: PromiseSettledResult<Awaited<T[P]>> }>;
42
41
 
43
42
  /**
44
43
  * Creates a Promise that is resolved with an array of results when all
@@ -46,5 +45,5 @@ interface PromiseConstructor {
46
45
  * @param values An array of Promises.
47
46
  * @returns A new Promise.
48
47
  */
49
- allSettled<T>(values: Iterable<T>): Promise<PromiseSettledResult<T extends PromiseLike<infer U> ? U : T>[]>;
48
+ allSettled<T>(values: Iterable<T | PromiseLike<T>>): Promise<PromiseSettledResult<Awaited<T>>[]>;
50
49
  }
@@ -22,3 +22,4 @@ and limitations under the License.
22
22
  /// <reference lib="es2021.promise" />
23
23
  /// <reference lib="es2021.string" />
24
24
  /// <reference lib="es2021.weakref" />
25
+ /// <reference lib="es2021.intl" />
@@ -0,0 +1,44 @@
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"/>
19
+
20
+
21
+ declare namespace Intl {
22
+
23
+ interface DateTimeFormatOptions {
24
+ formatMatcher?: "basic" | "best fit" | "best fit" | undefined;
25
+ dateStyle?: "full" | "long" | "medium" | "short" | undefined;
26
+ timeStyle?: "full" | "long" | "medium" | "short" | undefined;
27
+ dayPeriod?: "narrow" | "short" | "long" | undefined;
28
+ fractionalSecondDigits?: 0 | 1 | 2 | 3 | undefined;
29
+ }
30
+
31
+ interface ResolvedDateTimeFormatOptions {
32
+ formatMatcher?: "basic" | "best fit" | "best fit";
33
+ dateStyle?: "full" | "long" | "medium" | "short";
34
+ timeStyle?: "full" | "long" | "medium" | "short";
35
+ hourCycle?: "h11" | "h12" | "h23" | "h24";
36
+ dayPeriod?: "narrow" | "short" | "long";
37
+ fractionalSecondDigits?: 0 | 1 | 2 | 3;
38
+ }
39
+
40
+ interface NumberFormat {
41
+ formatRange(startDate: number | bigint, endDate: number | bigint): string;
42
+ formatRangeToParts(startDate: number | bigint, endDate: number | bigint): NumberFormatPart[];
43
+ }
44
+ }
@@ -39,5 +39,12 @@ interface PromiseConstructor {
39
39
  * @param values An array or iterable of Promises.
40
40
  * @returns A new Promise.
41
41
  */
42
- any<T>(values: (T | PromiseLike<T>)[] | Iterable<T | PromiseLike<T>>): Promise<T>
42
+ any<T extends readonly unknown[] | []>(values: T): Promise<Awaited<T[number]>>;
43
+
44
+ /**
45
+ * The any function returns a promise that is fulfilled by the first given promise to be fulfilled, or rejected with an AggregateError containing an array of rejection reasons if all of the given promises are rejected. It resolves all elements of the passed iterable to promises as it runs this algorithm.
46
+ * @param values An array or iterable of Promises.
47
+ * @returns A new Promise.
48
+ */
49
+ any<T>(values: Iterable<T | PromiseLike<T>>): Promise<Awaited<T>>
43
50
  }