@stencil/core 2.17.2 → 2.18.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 +32 -16
  2. package/cli/index.js +32 -16
  3. package/cli/package.json +1 -1
  4. package/compiler/lib.dom.d.ts +620 -89
  5. package/compiler/lib.dom.iterable.d.ts +27 -3
  6. package/compiler/lib.es2015.core.d.ts +3 -3
  7. package/compiler/lib.es2015.iterable.d.ts +2 -1
  8. package/compiler/lib.es2015.reflect.d.ts +1 -1
  9. package/compiler/lib.es2020.bigint.d.ts +7 -5
  10. package/compiler/lib.es2020.d.ts +2 -0
  11. package/compiler/lib.es2020.date.d.ts +44 -0
  12. package/compiler/lib.es2020.intl.d.ts +51 -11
  13. package/compiler/lib.es2020.number.d.ts +30 -0
  14. package/compiler/lib.es2021.intl.d.ts +106 -4
  15. package/compiler/lib.es2022.array.d.ts +123 -0
  16. package/compiler/lib.es2022.d.ts +26 -0
  17. package/compiler/lib.es2022.error.d.ts +75 -0
  18. package/compiler/lib.es2022.full.d.ts +25 -0
  19. package/compiler/lib.es2022.intl.d.ts +111 -0
  20. package/compiler/lib.es2022.object.d.ts +28 -0
  21. package/compiler/lib.es2022.string.d.ts +27 -0
  22. package/compiler/lib.es5.d.ts +25 -19
  23. package/compiler/lib.esnext.d.ts +1 -1
  24. package/compiler/lib.esnext.intl.d.ts +4 -1
  25. package/compiler/lib.webworker.d.ts +236 -40
  26. package/compiler/lib.webworker.iterable.d.ts +10 -3
  27. package/compiler/package.json +1 -1
  28. package/compiler/stencil.js +689 -232
  29. package/compiler/stencil.min.js +2 -2
  30. package/compiler/sys/in-memory-fs.d.ts +218 -0
  31. package/dependencies.json +10 -1
  32. package/dev-server/client/index.js +1 -1
  33. package/dev-server/client/package.json +1 -1
  34. package/dev-server/connector.html +2 -2
  35. package/dev-server/index.js +1 -1
  36. package/dev-server/package.json +1 -1
  37. package/dev-server/server-process.js +13 -13
  38. package/internal/app-data/package.json +1 -1
  39. package/internal/client/css-shim.js +1 -1
  40. package/internal/client/dom.js +1 -1
  41. package/internal/client/index.js +337 -157
  42. package/internal/client/package.json +1 -1
  43. package/internal/client/patch-browser.js +1 -1
  44. package/internal/client/patch-esm.js +1 -1
  45. package/internal/client/shadow-css.js +1 -1
  46. package/internal/hydrate/package.json +1 -1
  47. package/internal/hydrate/runner.d.ts +1 -1
  48. package/internal/package.json +1 -1
  49. package/internal/stencil-private.d.ts +2 -106
  50. package/internal/stencil-public-compiler.d.ts +42 -8
  51. package/internal/testing/package.json +1 -1
  52. package/mock-doc/index.cjs +77 -61
  53. package/mock-doc/index.d.ts +13 -12
  54. package/mock-doc/index.js +77 -61
  55. package/mock-doc/package.json +1 -1
  56. package/package.json +5 -7
  57. package/screenshot/index.js +10 -10
  58. package/screenshot/package.json +1 -1
  59. package/sys/node/index.js +1 -1
  60. package/sys/node/package.json +1 -1
  61. package/sys/node/worker.js +1 -1
  62. package/testing/index.js +96 -106
  63. package/testing/jest/jest-config.d.ts +1 -1
  64. package/testing/package.json +1 -1
  65. package/testing/testing-utils.d.ts +5 -4
@@ -69,6 +69,9 @@ interface DataTransferItemList {
69
69
  [Symbol.iterator](): IterableIterator<DataTransferItem>;
70
70
  }
71
71
 
72
+ interface EventCounts extends ReadonlyMap<string, number> {
73
+ }
74
+
72
75
  interface FileList {
73
76
  [Symbol.iterator](): IterableIterator<File>;
74
77
  }
@@ -130,6 +133,16 @@ interface IDBObjectStore {
130
133
  createIndex(name: string, keyPath: string | Iterable<string>, options?: IDBIndexParameters): IDBIndex;
131
134
  }
132
135
 
136
+ interface MIDIInputMap extends ReadonlyMap<string, MIDIInput> {
137
+ }
138
+
139
+ interface MIDIOutput {
140
+ send(data: Iterable<number>, timestamp?: DOMHighResTimeStamp): void;
141
+ }
142
+
143
+ interface MIDIOutputMap extends ReadonlyMap<string, MIDIOutput> {
144
+ }
145
+
133
146
  interface MediaKeyStatusMap {
134
147
  [Symbol.iterator](): IterableIterator<[BufferSource, MediaKeyStatus]>;
135
148
  entries(): IterableIterator<[BufferSource, MediaKeyStatus]>;
@@ -188,6 +201,10 @@ interface PluginArray {
188
201
  [Symbol.iterator](): IterableIterator<Plugin>;
189
202
  }
190
203
 
204
+ interface RTCRtpTransceiver {
205
+ setCodecPreferences(codecs: Iterable<RTCRtpCodecCapability>): void;
206
+ }
207
+
191
208
  interface RTCStatsReport extends ReadonlyMap<string, any> {
192
209
  }
193
210
 
@@ -229,10 +246,10 @@ interface StyleSheetList {
229
246
 
230
247
  interface SubtleCrypto {
231
248
  deriveKey(algorithm: AlgorithmIdentifier | EcdhKeyDeriveParams | HkdfParams | Pbkdf2Params, baseKey: CryptoKey, derivedKeyType: AlgorithmIdentifier | AesDerivedKeyParams | HmacImportParams | HkdfParams | Pbkdf2Params, extractable: boolean, keyUsages: Iterable<KeyUsage>): Promise<CryptoKey>;
232
- generateKey(algorithm: RsaHashedKeyGenParams | EcKeyGenParams, extractable: boolean, keyUsages: KeyUsage[]): Promise<CryptoKeyPair>;
233
- generateKey(algorithm: AesKeyGenParams | HmacKeyGenParams | Pbkdf2Params, extractable: boolean, keyUsages: KeyUsage[]): Promise<CryptoKey>;
249
+ generateKey(algorithm: RsaHashedKeyGenParams | EcKeyGenParams, extractable: boolean, keyUsages: ReadonlyArray<KeyUsage>): Promise<CryptoKeyPair>;
250
+ generateKey(algorithm: AesKeyGenParams | HmacKeyGenParams | Pbkdf2Params, extractable: boolean, keyUsages: ReadonlyArray<KeyUsage>): Promise<CryptoKey>;
234
251
  generateKey(algorithm: AlgorithmIdentifier, extractable: boolean, keyUsages: Iterable<KeyUsage>): Promise<CryptoKeyPair | CryptoKey>;
235
- importKey(format: "jwk", keyData: JsonWebKey, algorithm: AlgorithmIdentifier | RsaHashedImportParams | EcKeyImportParams | HmacImportParams | AesKeyAlgorithm, extractable: boolean, keyUsages: KeyUsage[]): Promise<CryptoKey>;
252
+ importKey(format: "jwk", keyData: JsonWebKey, algorithm: AlgorithmIdentifier | RsaHashedImportParams | EcKeyImportParams | HmacImportParams | AesKeyAlgorithm, extractable: boolean, keyUsages: ReadonlyArray<KeyUsage>): Promise<CryptoKey>;
236
253
  importKey(format: Exclude<KeyFormat, "jwk">, keyData: BufferSource, algorithm: AlgorithmIdentifier | RsaHashedImportParams | EcKeyImportParams | HmacImportParams | AesKeyAlgorithm, extractable: boolean, keyUsages: Iterable<KeyUsage>): Promise<CryptoKey>;
237
254
  unwrapKey(format: KeyFormat, wrappedKey: BufferSource, unwrappingKey: CryptoKey, unwrapAlgorithm: AlgorithmIdentifier | RsaOaepParams | AesCtrParams | AesCbcParams | AesGcmParams, unwrappedKeyAlgorithm: AlgorithmIdentifier | RsaHashedImportParams | EcKeyImportParams | HmacImportParams | AesKeyAlgorithm, extractable: boolean, keyUsages: Iterable<KeyUsage>): Promise<CryptoKey>;
238
255
  }
@@ -263,6 +280,13 @@ interface WEBGL_draw_buffers {
263
280
  drawBuffersWEBGL(buffers: Iterable<GLenum>): void;
264
281
  }
265
282
 
283
+ interface WEBGL_multi_draw {
284
+ multiDrawArraysInstancedWEBGL(mode: GLenum, firstsList: Int32Array | Iterable<GLint>, firstsOffset: GLuint, countsList: Int32Array | Iterable<GLsizei>, countsOffset: GLuint, instanceCountsList: Int32Array | Iterable<GLsizei>, instanceCountsOffset: GLuint, drawcount: GLsizei): void;
285
+ multiDrawArraysWEBGL(mode: GLenum, firstsList: Int32Array | Iterable<GLint>, firstsOffset: GLuint, countsList: Int32Array | Iterable<GLsizei>, countsOffset: GLuint, drawcount: GLsizei): void;
286
+ multiDrawElementsInstancedWEBGL(mode: GLenum, countsList: Int32Array | Iterable<GLint>, countsOffset: GLuint, type: GLenum, offsetsList: Int32Array | Iterable<GLsizei>, offsetsOffset: GLuint, instanceCountsList: Int32Array | Iterable<GLsizei>, instanceCountsOffset: GLuint, drawcount: GLsizei): void;
287
+ multiDrawElementsWEBGL(mode: GLenum, countsList: Int32Array | Iterable<GLint>, countsOffset: GLuint, type: GLenum, offsetsList: Int32Array | Iterable<GLsizei>, offsetsOffset: GLuint, drawcount: GLsizei): void;
288
+ }
289
+
266
290
  interface WebGL2RenderingContextBase {
267
291
  clearBufferfv(buffer: GLenum, drawbuffer: GLint, values: Iterable<GLfloat>, srcOffset?: GLuint): void;
268
292
  clearBufferiv(buffer: GLenum, drawbuffer: GLint, values: Iterable<GLint>, srcOffset?: GLuint): void;
@@ -283,7 +283,7 @@ interface ObjectConstructor {
283
283
  * @param target The target object to copy to.
284
284
  * @param source The source object from which to copy properties.
285
285
  */
286
- assign<T, U>(target: T, source: U): T & U;
286
+ assign<T extends {}, U>(target: T, source: U): T & U;
287
287
 
288
288
  /**
289
289
  * Copy the values of all of the enumerable own properties from one or more source objects to a
@@ -292,7 +292,7 @@ interface ObjectConstructor {
292
292
  * @param source1 The first source object from which to copy properties.
293
293
  * @param source2 The second source object from which to copy properties.
294
294
  */
295
- assign<T, U, V>(target: T, source1: U, source2: V): T & U & V;
295
+ assign<T extends {}, U, V>(target: T, source1: U, source2: V): T & U & V;
296
296
 
297
297
  /**
298
298
  * Copy the values of all of the enumerable own properties from one or more source objects to a
@@ -302,7 +302,7 @@ interface ObjectConstructor {
302
302
  * @param source2 The second source object from which to copy properties.
303
303
  * @param source3 The third source object from which to copy properties.
304
304
  */
305
- assign<T, U, V, W>(target: T, source1: U, source2: V, source3: W): T & U & V & W;
305
+ assign<T extends {}, U, V, W>(target: T, source1: U, source2: V, source3: W): T & U & V & W;
306
306
 
307
307
  /**
308
308
  * Copy the values of all of the enumerable own properties from one or more source objects to a
@@ -157,7 +157,8 @@ interface ReadonlyMap<K, V> {
157
157
  }
158
158
 
159
159
  interface MapConstructor {
160
- new <K, V>(iterable: Iterable<readonly [K, V]>): Map<K, V>;
160
+ new(): Map<any, any>;
161
+ new <K, V>(iterable?: Iterable<readonly [K, V]> | null): Map<K, V>;
161
162
  }
162
163
 
163
164
  interface WeakMap<K extends object, V> { }
@@ -44,7 +44,7 @@ declare namespace Reflect {
44
44
  * @param propertyKey The property name.
45
45
  * @param attributes Descriptor for the property. It can be for a data property or an accessor property.
46
46
  */
47
- function defineProperty(target: object, propertyKey: PropertyKey, attributes: PropertyDescriptor): boolean;
47
+ function defineProperty(target: object, propertyKey: PropertyKey, attributes: PropertyDescriptor & ThisType<any>): boolean;
48
48
 
49
49
  /**
50
50
  * Removes a property from an object, equivalent to `delete target[propertyKey]`,
@@ -18,6 +18,8 @@ and limitations under the License.
18
18
  /// <reference no-default-lib="true"/>
19
19
 
20
20
 
21
+ /// <reference lib="es2020.intl" />
22
+
21
23
  interface BigIntToLocaleStringOptions {
22
24
  /**
23
25
  * The locale matching algorithm to use.The default is "best fit". For information about this option, see the {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl#Locale_negotiation Intl page}.
@@ -112,7 +114,7 @@ interface BigInt {
112
114
  toString(radix?: number): string;
113
115
 
114
116
  /** Returns a string representation appropriate to the host environment's current locale. */
115
- toLocaleString(locales?: string, options?: BigIntToLocaleStringOptions): string;
117
+ toLocaleString(locales?: Intl.LocalesArgument, options?: BigIntToLocaleStringOptions): string;
116
118
 
117
119
  /** Returns the primitive value of the specified object. */
118
120
  valueOf(): bigint;
@@ -691,6 +693,7 @@ interface DataView {
691
693
  * Gets the BigInt64 value at the specified byte offset from the start of the view. There is
692
694
  * no alignment constraint; multi-byte values may be fetched from any offset.
693
695
  * @param byteOffset The place in the buffer at which the value should be retrieved.
696
+ * @param littleEndian If false or undefined, a big-endian value should be read.
694
697
  */
695
698
  getBigInt64(byteOffset: number, littleEndian?: boolean): bigint;
696
699
 
@@ -698,6 +701,7 @@ interface DataView {
698
701
  * Gets the BigUint64 value at the specified byte offset from the start of the view. There is
699
702
  * no alignment constraint; multi-byte values may be fetched from any offset.
700
703
  * @param byteOffset The place in the buffer at which the value should be retrieved.
704
+ * @param littleEndian If false or undefined, a big-endian value should be read.
701
705
  */
702
706
  getBigUint64(byteOffset: number, littleEndian?: boolean): bigint;
703
707
 
@@ -705,8 +709,7 @@ interface DataView {
705
709
  * Stores a BigInt64 value at the specified byte offset from the start of the view.
706
710
  * @param byteOffset The place in the buffer at which the value should be set.
707
711
  * @param value The value to set.
708
- * @param littleEndian If false or undefined, a big-endian value should be written,
709
- * otherwise a little-endian value should be written.
712
+ * @param littleEndian If false or undefined, a big-endian value should be written.
710
713
  */
711
714
  setBigInt64(byteOffset: number, value: bigint, littleEndian?: boolean): void;
712
715
 
@@ -714,8 +717,7 @@ interface DataView {
714
717
  * Stores a BigUint64 value at the specified byte offset from the start of the view.
715
718
  * @param byteOffset The place in the buffer at which the value should be set.
716
719
  * @param value The value to set.
717
- * @param littleEndian If false or undefined, a big-endian value should be written,
718
- * otherwise a little-endian value should be written.
720
+ * @param littleEndian If false or undefined, a big-endian value should be written.
719
721
  */
720
722
  setBigUint64(byteOffset: number, value: bigint, littleEndian?: boolean): void;
721
723
  }
@@ -20,6 +20,8 @@ and limitations under the License.
20
20
 
21
21
  /// <reference lib="es2019" />
22
22
  /// <reference lib="es2020.bigint" />
23
+ /// <reference lib="es2020.date" />
24
+ /// <reference lib="es2020.number" />
23
25
  /// <reference lib="es2020.promise" />
24
26
  /// <reference lib="es2020.sharedmemory" />
25
27
  /// <reference lib="es2020.string" />
@@ -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
+ /// <reference lib="es2020.intl" />
22
+
23
+ interface Date {
24
+ /**
25
+ * Converts a date and time to a string by using the current or specified locale.
26
+ * @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.
27
+ * @param options An object that contains one or more properties that specify comparison options.
28
+ */
29
+ toLocaleString(locales?: Intl.LocalesArgument, options?: Intl.DateTimeFormatOptions): string;
30
+
31
+ /**
32
+ * Converts a date to a string by using the current or specified locale.
33
+ * @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.
34
+ * @param options An object that contains one or more properties that specify comparison options.
35
+ */
36
+ toLocaleDateString(locales?: Intl.LocalesArgument, options?: Intl.DateTimeFormatOptions): string;
37
+
38
+ /**
39
+ * Converts a time to a string by using the current or specified locale.
40
+ * @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.
41
+ * @param options An object that contains one or more properties that specify comparison options.
42
+ */
43
+ toLocaleTimeString(locales?: Intl.LocalesArgument, options?: Intl.DateTimeFormatOptions): string;
44
+ }
@@ -78,6 +78,13 @@ declare namespace Intl {
78
78
  */
79
79
  type BCP47LanguageTag = string;
80
80
 
81
+ /**
82
+ * The locale(s) to use
83
+ *
84
+ * [MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl#locales_argument).
85
+ */
86
+ type LocalesArgument = UnicodeBCP47LocaleIdentifier | Locale | (UnicodeBCP47LocaleIdentifier | Locale)[] | undefined;
87
+
81
88
  /**
82
89
  * An object with some or all of properties of `options` parameter
83
90
  * of `Intl.RelativeTimeFormat` constructor.
@@ -220,17 +227,21 @@ declare namespace Intl {
220
227
  interface NumberFormatOptions {
221
228
  compactDisplay?: "short" | "long" | undefined;
222
229
  notation?: "standard" | "scientific" | "engineering" | "compact" | undefined;
223
- signDisplay?: "auto" | "never" | "always" | undefined;
230
+ signDisplay?: "auto" | "never" | "always" | "exceptZero" | undefined;
224
231
  unit?: string | undefined;
225
232
  unitDisplay?: "short" | "long" | "narrow" | undefined;
233
+ currencyDisplay?: string | undefined;
234
+ currencySign?: string | undefined;
226
235
  }
227
236
 
228
237
  interface ResolvedNumberFormatOptions {
229
238
  compactDisplay?: "short" | "long";
230
239
  notation?: "standard" | "scientific" | "engineering" | "compact";
231
- signDisplay?: "auto" | "never" | "always";
240
+ signDisplay?: "auto" | "never" | "always" | "exceptZero";
232
241
  unit?: string;
233
242
  unitDisplay?: "short" | "long" | "narrow";
243
+ currencyDisplay?: string;
244
+ currencySign?: string;
234
245
  }
235
246
 
236
247
  interface DateTimeFormatOptions {
@@ -270,6 +281,10 @@ declare namespace Intl {
270
281
  }
271
282
 
272
283
  interface Locale extends LocaleOptions {
284
+ /** A string containing the language, and the script and region if available. */
285
+ baseName: string;
286
+ /** The primary language subtag associated with the locale. */
287
+ language: string;
273
288
  /** Gets the most likely values for the language, script, and region of the locale based on existing values. */
274
289
  maximize(): Locale;
275
290
  /** Attempts to remove information about the locale that would be added by calling `Locale.maximize()`. */
@@ -293,14 +308,39 @@ declare namespace Intl {
293
308
  * [MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/Locale).
294
309
  */
295
310
  const Locale: {
296
- new (tag?: BCP47LanguageTag, options?: LocaleOptions): Locale;
311
+ new (tag: BCP47LanguageTag | Locale, options?: LocaleOptions): Locale;
297
312
  };
298
313
 
299
- interface DisplayNamesOptions {
300
- localeMatcher: RelativeTimeFormatLocaleMatcher;
314
+ type DisplayNamesFallback =
315
+ | "code"
316
+ | "none";
317
+
318
+ type DisplayNamesType =
319
+ | "language"
320
+ | "region"
321
+ | "script"
322
+ | "calendar"
323
+ | "dateTimeField"
324
+ | "currency";
325
+
326
+ type DisplayNamesLanguageDisplay =
327
+ | "dialect"
328
+ | "standard";
329
+
330
+ interface DisplayNamesOptions {
331
+ localeMatcher?: RelativeTimeFormatLocaleMatcher;
332
+ style?: RelativeTimeFormatStyle;
333
+ type: DisplayNamesType;
334
+ languageDisplay?: DisplayNamesLanguageDisplay;
335
+ fallback?: DisplayNamesFallback;
336
+ }
337
+
338
+ interface ResolvedDisplayNamesOptions {
339
+ locale: UnicodeBCP47LocaleIdentifier;
301
340
  style: RelativeTimeFormatStyle;
302
- type: "language" | "region" | "script" | "currency";
303
- fallback: "code" | "none";
341
+ type: DisplayNamesType;
342
+ fallback: DisplayNamesFallback;
343
+ languageDisplay?: DisplayNamesLanguageDisplay;
304
344
  }
305
345
 
306
346
  interface DisplayNames {
@@ -319,14 +359,14 @@ declare namespace Intl {
319
359
  *
320
360
  * [MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/DisplayNames/of).
321
361
  */
322
- of(code: string): string;
362
+ of(code: string): string | undefined;
323
363
  /**
324
364
  * Returns a new object with properties reflecting the locale and style formatting options computed during the construction of the current
325
365
  * [`Intl/DisplayNames`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/DisplayNames) object.
326
366
  *
327
367
  * [MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/DisplayNames/resolvedOptions).
328
368
  */
329
- resolvedOptions(): DisplayNamesOptions;
369
+ resolvedOptions(): ResolvedDisplayNamesOptions;
330
370
  }
331
371
 
332
372
  /**
@@ -347,7 +387,7 @@ declare namespace Intl {
347
387
  *
348
388
  * [MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/DisplayNames/DisplayNames).
349
389
  */
350
- new(locales?: BCP47LanguageTag | BCP47LanguageTag[], options?: Partial<DisplayNamesOptions>): DisplayNames;
390
+ new(locales: LocalesArgument, options: DisplayNamesOptions): DisplayNames;
351
391
 
352
392
  /**
353
393
  * 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.
@@ -362,7 +402,7 @@ declare namespace Intl {
362
402
  *
363
403
  * [MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/DisplayNames/supportedLocalesOf).
364
404
  */
365
- supportedLocalesOf(locales: BCP47LanguageTag | BCP47LanguageTag[], options?: {localeMatcher: RelativeTimeFormatLocaleMatcher}): BCP47LanguageTag[];
405
+ supportedLocalesOf(locales?: LocalesArgument, options?: { localeMatcher?: RelativeTimeFormatLocaleMatcher }): BCP47LanguageTag[];
366
406
  };
367
407
 
368
408
  }
@@ -0,0 +1,30 @@
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
+ /// <reference lib="es2020.intl" />
22
+
23
+ interface Number {
24
+ /**
25
+ * Converts a number to a string by using the current or specified locale.
26
+ * @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.
27
+ * @param options An object that contains one or more properties that specify comparison options.
28
+ */
29
+ toLocaleString(locales?: Intl.LocalesArgument, options?: Intl.NumberFormatOptions): string;
30
+ }
@@ -28,6 +28,11 @@ declare namespace Intl {
28
28
  fractionalSecondDigits?: 0 | 1 | 2 | 3 | undefined;
29
29
  }
30
30
 
31
+ interface DateTimeFormat {
32
+ formatRange(startDate: Date | number | bigint, endDate: Date | number | bigint): string;
33
+ formatRangeToParts(startDate: Date | number | bigint, endDate: Date | number | bigint): DateTimeFormatPart[];
34
+ }
35
+
31
36
  interface ResolvedDateTimeFormatOptions {
32
37
  formatMatcher?: "basic" | "best fit" | "best fit";
33
38
  dateStyle?: "full" | "long" | "medium" | "short";
@@ -37,8 +42,105 @@ declare namespace Intl {
37
42
  fractionalSecondDigits?: 0 | 1 | 2 | 3;
38
43
  }
39
44
 
40
- interface NumberFormat {
41
- formatRange(startDate: number | bigint, endDate: number | bigint): string;
42
- formatRangeToParts(startDate: number | bigint, endDate: number | bigint): NumberFormatPart[];
45
+ /**
46
+ * The locale matching algorithm to use.
47
+ *
48
+ * [MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/ListFormat/ListFormat#parameters).
49
+ */
50
+ type ListFormatLocaleMatcher = "lookup" | "best fit";
51
+
52
+ /**
53
+ * The format of output message.
54
+ *
55
+ * [MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/ListFormat/ListFormat#parameters).
56
+ */
57
+ type ListFormatType = "conjunction" | "disjunction" | "unit";
58
+
59
+ /**
60
+ * The length of the formatted message.
61
+ *
62
+ * [MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/ListFormat/ListFormat#parameters).
63
+ */
64
+ type ListFormatStyle = "long" | "short" | "narrow";
65
+
66
+ /**
67
+ * An object with some or all properties of the `Intl.ListFormat` constructor `options` parameter.
68
+ *
69
+ * [MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/ListFormat/ListFormat#parameters).
70
+ */
71
+ interface ListFormatOptions {
72
+ /** 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). */
73
+ localeMatcher?: ListFormatLocaleMatcher | undefined;
74
+ /** The format of output message. */
75
+ type?: ListFormatType | undefined;
76
+ /** The length of the internationalized message. */
77
+ style?: ListFormatStyle | undefined;
43
78
  }
44
- }
79
+
80
+ interface ListFormat {
81
+ /**
82
+ * Returns a string with a language-specific representation of the list.
83
+ *
84
+ * @param list - An iterable object, such as an [Array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array).
85
+ *
86
+ * @throws `TypeError` if `list` includes something other than the possible values.
87
+ *
88
+ * @returns {string} A language-specific formatted string representing the elements of the list.
89
+ *
90
+ * [MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/ListFormat/format).
91
+ */
92
+ format(list: Iterable<string>): string;
93
+
94
+ /**
95
+ * Returns an Array of objects representing the different components that can be used to format a list of values in a locale-aware fashion.
96
+ *
97
+ * @param list - An iterable object, such as an [Array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array), to be formatted according to a locale.
98
+ *
99
+ * @throws `TypeError` if `list` includes something other than the possible values.
100
+ *
101
+ * @returns {{ type: "element" | "literal", value: string; }[]} An Array of components which contains the formatted parts from the list.
102
+ *
103
+ * [MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/ListFormat/formatToParts).
104
+ */
105
+ formatToParts(list: Iterable<string>): { type: "element" | "literal", value: string; }[];
106
+ }
107
+
108
+ const ListFormat: {
109
+ prototype: ListFormat;
110
+
111
+ /**
112
+ * Creates [Intl.ListFormat](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/ListFormat) objects that
113
+ * enable language-sensitive list formatting.
114
+ *
115
+ * @param locales - A string with a [BCP 47 language tag](http://tools.ietf.org/html/rfc5646), or an array of such strings.
116
+ * For the general form and interpretation of the `locales` argument,
117
+ * see the [`Intl` page](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl#Locale_identification_and_negotiation).
118
+ *
119
+ * @param options - An [object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/ListFormat/ListFormat#parameters)
120
+ * with some or all options of `ListFormatOptions`.
121
+ *
122
+ * @returns [Intl.ListFormatOptions](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/ListFormat) object.
123
+ *
124
+ * [MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/ListFormat).
125
+ */
126
+ new(locales?: BCP47LanguageTag | BCP47LanguageTag[], options?: ListFormatOptions): ListFormat;
127
+
128
+ /**
129
+ * Returns an array containing those of the provided locales that are
130
+ * supported in list formatting without having to fall back to the runtime's default locale.
131
+ *
132
+ * @param locales - A string with a [BCP 47 language tag](http://tools.ietf.org/html/rfc5646), or an array of such strings.
133
+ * For the general form and interpretation of the `locales` argument,
134
+ * see the [`Intl` page](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl#Locale_identification_and_negotiation).
135
+ *
136
+ * @param options - An [object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/ListFormat/supportedLocalesOf#parameters).
137
+ * with some or all possible options.
138
+ *
139
+ * @returns An array of strings representing a subset of the given locale tags that are supported in list
140
+ * formatting without having to fall back to the runtime's default locale.
141
+ *
142
+ * [MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/ListFormat/supportedLocalesOf).
143
+ */
144
+ supportedLocalesOf(locales: BCP47LanguageTag | BCP47LanguageTag[], options?: Pick<ListFormatOptions, "localeMatcher">): BCP47LanguageTag[];
145
+ };
146
+ }
@@ -0,0 +1,123 @@
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
+ interface Array<T> {
22
+ /**
23
+ * Returns the item located at the specified index.
24
+ * @param index The zero-based index of the desired code unit. A negative index will count back from the last item.
25
+ */
26
+ at(index: number): T | undefined;
27
+ }
28
+
29
+ interface ReadonlyArray<T> {
30
+ /**
31
+ * Returns the item located at the specified index.
32
+ * @param index The zero-based index of the desired code unit. A negative index will count back from the last item.
33
+ */
34
+ at(index: number): T | undefined;
35
+ }
36
+
37
+ interface Int8Array {
38
+ /**
39
+ * Returns the item located at the specified index.
40
+ * @param index The zero-based index of the desired code unit. A negative index will count back from the last item.
41
+ */
42
+ at(index: number): number | undefined;
43
+ }
44
+
45
+ interface Uint8Array {
46
+ /**
47
+ * Returns the item located at the specified index.
48
+ * @param index The zero-based index of the desired code unit. A negative index will count back from the last item.
49
+ */
50
+ at(index: number): number | undefined;
51
+ }
52
+
53
+ interface Uint8ClampedArray {
54
+ /**
55
+ * Returns the item located at the specified index.
56
+ * @param index The zero-based index of the desired code unit. A negative index will count back from the last item.
57
+ */
58
+ at(index: number): number | undefined;
59
+ }
60
+
61
+ interface Int16Array {
62
+ /**
63
+ * Returns the item located at the specified index.
64
+ * @param index The zero-based index of the desired code unit. A negative index will count back from the last item.
65
+ */
66
+ at(index: number): number | undefined;
67
+ }
68
+
69
+ interface Uint16Array {
70
+ /**
71
+ * Returns the item located at the specified index.
72
+ * @param index The zero-based index of the desired code unit. A negative index will count back from the last item.
73
+ */
74
+ at(index: number): number | undefined;
75
+ }
76
+
77
+ interface Int32Array {
78
+ /**
79
+ * Returns the item located at the specified index.
80
+ * @param index The zero-based index of the desired code unit. A negative index will count back from the last item.
81
+ */
82
+ at(index: number): number | undefined;
83
+ }
84
+
85
+ interface Uint32Array {
86
+ /**
87
+ * Returns the item located at the specified index.
88
+ * @param index The zero-based index of the desired code unit. A negative index will count back from the last item.
89
+ */
90
+ at(index: number): number | undefined;
91
+ }
92
+
93
+ interface Float32Array {
94
+ /**
95
+ * Returns the item located at the specified index.
96
+ * @param index The zero-based index of the desired code unit. A negative index will count back from the last item.
97
+ */
98
+ at(index: number): number | undefined;
99
+ }
100
+
101
+ interface Float64Array {
102
+ /**
103
+ * Returns the item located at the specified index.
104
+ * @param index The zero-based index of the desired code unit. A negative index will count back from the last item.
105
+ */
106
+ at(index: number): number | undefined;
107
+ }
108
+
109
+ interface BigInt64Array {
110
+ /**
111
+ * Returns the item located at the specified index.
112
+ * @param index The zero-based index of the desired code unit. A negative index will count back from the last item.
113
+ */
114
+ at(index: number): bigint | undefined;
115
+ }
116
+
117
+ interface BigUint64Array {
118
+ /**
119
+ * Returns the item located at the specified index.
120
+ * @param index The zero-based index of the desired code unit. A negative index will count back from the last item.
121
+ */
122
+ at(index: number): bigint | undefined;
123
+ }
@@ -0,0 +1,26 @@
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
+ /// <reference lib="es2021" />
22
+ /// <reference lib="es2022.array" />
23
+ /// <reference lib="es2022.error" />
24
+ /// <reference lib="es2022.intl" />
25
+ /// <reference lib="es2022.object" />
26
+ /// <reference lib="es2022.string" />