typescript 4.6.3 → 4.7.0-beta
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.
- package/lib/cs/diagnosticMessages.generated.json +59 -41
- package/lib/de/diagnosticMessages.generated.json +59 -41
- package/lib/es/diagnosticMessages.generated.json +52 -34
- package/lib/fr/diagnosticMessages.generated.json +41 -23
- package/lib/it/diagnosticMessages.generated.json +61 -43
- package/lib/ja/diagnosticMessages.generated.json +40 -22
- package/lib/ko/diagnosticMessages.generated.json +60 -42
- package/lib/lib.dom.d.ts +404 -31
- package/lib/lib.dom.iterable.d.ts +16 -3
- package/lib/lib.es2015.core.d.ts +3 -3
- package/lib/lib.es2015.reflect.d.ts +1 -1
- package/lib/lib.es2020.bigint.d.ts +3 -1
- package/lib/lib.es2020.d.ts +2 -0
- package/lib/lib.es2020.date.d.ts +44 -0
- package/lib/lib.es2020.intl.d.ts +43 -8
- package/lib/lib.es2020.number.d.ts +30 -0
- package/lib/lib.es2021.intl.d.ts +106 -4
- package/lib/lib.es5.d.ts +10 -2
- package/lib/lib.esnext.intl.d.ts +4 -1
- package/lib/lib.webworker.d.ts +110 -25
- package/lib/lib.webworker.iterable.d.ts +3 -3
- package/lib/pl/diagnosticMessages.generated.json +44 -26
- package/lib/protocol.d.ts +42 -2
- package/lib/pt-br/diagnosticMessages.generated.json +50 -32
- package/lib/ru/diagnosticMessages.generated.json +48 -30
- package/lib/tr/diagnosticMessages.generated.json +61 -43
- package/lib/tsc.js +7045 -5816
- package/lib/tsserver.js +22377 -20198
- package/lib/tsserverlibrary.d.ts +428 -293
- package/lib/tsserverlibrary.js +22364 -20186
- package/lib/typescript.d.ts +385 -290
- package/lib/typescript.js +22050 -19980
- package/lib/typescriptServices.d.ts +385 -290
- package/lib/typescriptServices.js +22050 -19980
- package/lib/typingsInstaller.js +16680 -15206
- package/lib/zh-cn/diagnosticMessages.generated.json +49 -31
- package/lib/zh-tw/diagnosticMessages.generated.json +61 -43
- package/package.json +1 -10
|
@@ -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]>;
|
|
@@ -233,10 +246,10 @@ interface StyleSheetList {
|
|
|
233
246
|
|
|
234
247
|
interface SubtleCrypto {
|
|
235
248
|
deriveKey(algorithm: AlgorithmIdentifier | EcdhKeyDeriveParams | HkdfParams | Pbkdf2Params, baseKey: CryptoKey, derivedKeyType: AlgorithmIdentifier | AesDerivedKeyParams | HmacImportParams | HkdfParams | Pbkdf2Params, extractable: boolean, keyUsages: Iterable<KeyUsage>): Promise<CryptoKey>;
|
|
236
|
-
generateKey(algorithm: RsaHashedKeyGenParams | EcKeyGenParams, extractable: boolean, keyUsages: KeyUsage
|
|
237
|
-
generateKey(algorithm: AesKeyGenParams | HmacKeyGenParams | Pbkdf2Params, extractable: boolean, keyUsages: KeyUsage
|
|
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>;
|
|
238
251
|
generateKey(algorithm: AlgorithmIdentifier, extractable: boolean, keyUsages: Iterable<KeyUsage>): Promise<CryptoKeyPair | CryptoKey>;
|
|
239
|
-
importKey(format: "jwk", keyData: JsonWebKey, algorithm: AlgorithmIdentifier | RsaHashedImportParams | EcKeyImportParams | HmacImportParams | AesKeyAlgorithm, extractable: boolean, keyUsages: KeyUsage
|
|
252
|
+
importKey(format: "jwk", keyData: JsonWebKey, algorithm: AlgorithmIdentifier | RsaHashedImportParams | EcKeyImportParams | HmacImportParams | AesKeyAlgorithm, extractable: boolean, keyUsages: ReadonlyArray<KeyUsage>): Promise<CryptoKey>;
|
|
240
253
|
importKey(format: Exclude<KeyFormat, "jwk">, keyData: BufferSource, algorithm: AlgorithmIdentifier | RsaHashedImportParams | EcKeyImportParams | HmacImportParams | AesKeyAlgorithm, extractable: boolean, keyUsages: Iterable<KeyUsage>): Promise<CryptoKey>;
|
|
241
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>;
|
|
242
255
|
}
|
package/lib/lib.es2015.core.d.ts
CHANGED
|
@@ -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
|
|
@@ -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?:
|
|
117
|
+
toLocaleString(locales?: Intl.LocalesArgument, options?: BigIntToLocaleStringOptions): string;
|
|
116
118
|
|
|
117
119
|
/** Returns the primitive value of the specified object. */
|
|
118
120
|
valueOf(): bigint;
|
package/lib/lib.es2020.d.ts
CHANGED
|
@@ -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
|
+
}
|
package/lib/lib.es2020.intl.d.ts
CHANGED
|
@@ -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.
|
|
@@ -274,6 +281,10 @@ declare namespace Intl {
|
|
|
274
281
|
}
|
|
275
282
|
|
|
276
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;
|
|
277
288
|
/** Gets the most likely values for the language, script, and region of the locale based on existing values. */
|
|
278
289
|
maximize(): Locale;
|
|
279
290
|
/** Attempts to remove information about the locale that would be added by calling `Locale.maximize()`. */
|
|
@@ -297,15 +308,39 @@ declare namespace Intl {
|
|
|
297
308
|
* [MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/Locale).
|
|
298
309
|
*/
|
|
299
310
|
const Locale: {
|
|
300
|
-
new (tag
|
|
311
|
+
new (tag: BCP47LanguageTag | Locale, options?: LocaleOptions): Locale;
|
|
301
312
|
};
|
|
302
313
|
|
|
303
|
-
|
|
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 {
|
|
304
339
|
locale: UnicodeBCP47LocaleIdentifier;
|
|
305
|
-
localeMatcher: RelativeTimeFormatLocaleMatcher;
|
|
306
340
|
style: RelativeTimeFormatStyle;
|
|
307
|
-
type:
|
|
308
|
-
fallback:
|
|
341
|
+
type: DisplayNamesType;
|
|
342
|
+
fallback: DisplayNamesFallback;
|
|
343
|
+
languageDisplay?: DisplayNamesLanguageDisplay;
|
|
309
344
|
}
|
|
310
345
|
|
|
311
346
|
interface DisplayNames {
|
|
@@ -331,7 +366,7 @@ declare namespace Intl {
|
|
|
331
366
|
*
|
|
332
367
|
* [MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/DisplayNames/resolvedOptions).
|
|
333
368
|
*/
|
|
334
|
-
resolvedOptions():
|
|
369
|
+
resolvedOptions(): ResolvedDisplayNamesOptions;
|
|
335
370
|
}
|
|
336
371
|
|
|
337
372
|
/**
|
|
@@ -352,7 +387,7 @@ declare namespace Intl {
|
|
|
352
387
|
*
|
|
353
388
|
* [MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/DisplayNames/DisplayNames).
|
|
354
389
|
*/
|
|
355
|
-
new(locales
|
|
390
|
+
new(locales: LocalesArgument, options: DisplayNamesOptions): DisplayNames;
|
|
356
391
|
|
|
357
392
|
/**
|
|
358
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.
|
|
@@ -367,7 +402,7 @@ declare namespace Intl {
|
|
|
367
402
|
*
|
|
368
403
|
* [MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/DisplayNames/supportedLocalesOf).
|
|
369
404
|
*/
|
|
370
|
-
supportedLocalesOf(locales
|
|
405
|
+
supportedLocalesOf(locales?: LocalesArgument, options?: { localeMatcher?: RelativeTimeFormatLocaleMatcher }): BCP47LanguageTag[];
|
|
371
406
|
};
|
|
372
407
|
|
|
373
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
|
+
}
|
package/lib/lib.es2021.intl.d.ts
CHANGED
|
@@ -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
|
-
|
|
41
|
-
|
|
42
|
-
|
|
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
|
+
}
|
package/lib/lib.es5.d.ts
CHANGED
|
@@ -226,6 +226,12 @@ interface ObjectConstructor {
|
|
|
226
226
|
*/
|
|
227
227
|
freeze<T extends Function>(f: T): T;
|
|
228
228
|
|
|
229
|
+
/**
|
|
230
|
+
* Prevents the modification of existing property attributes and values, and prevents the addition of new properties.
|
|
231
|
+
* @param o Object on which to lock the attributes.
|
|
232
|
+
*/
|
|
233
|
+
freeze<T extends {[idx: string]: U | null | undefined | object}, U extends string | bigint | number | boolean | symbol>(o: T): Readonly<T>;
|
|
234
|
+
|
|
229
235
|
/**
|
|
230
236
|
* Prevents the modification of existing property attributes and values, and prevents the addition of new properties.
|
|
231
237
|
* @param o Object on which to lock the attributes.
|
|
@@ -320,7 +326,7 @@ declare var Function: FunctionConstructor;
|
|
|
320
326
|
/**
|
|
321
327
|
* Extracts the type of the 'this' parameter of a function type, or 'unknown' if the function type has no 'this' parameter.
|
|
322
328
|
*/
|
|
323
|
-
type ThisParameterType<T> = T extends (this: infer U, ...args:
|
|
329
|
+
type ThisParameterType<T> = T extends (this: infer U, ...args: never) => any ? U : unknown;
|
|
324
330
|
|
|
325
331
|
/**
|
|
326
332
|
* Removes the 'this' parameter from a function type.
|
|
@@ -4405,6 +4411,7 @@ declare namespace Intl {
|
|
|
4405
4411
|
new(locales?: string | string[], options?: NumberFormatOptions): NumberFormat;
|
|
4406
4412
|
(locales?: string | string[], options?: NumberFormatOptions): NumberFormat;
|
|
4407
4413
|
supportedLocalesOf(locales: string | string[], options?: NumberFormatOptions): string[];
|
|
4414
|
+
readonly prototype: NumberFormat;
|
|
4408
4415
|
};
|
|
4409
4416
|
|
|
4410
4417
|
interface DateTimeFormatOptions {
|
|
@@ -4417,7 +4424,7 @@ declare namespace Intl {
|
|
|
4417
4424
|
hour?: "numeric" | "2-digit" | undefined;
|
|
4418
4425
|
minute?: "numeric" | "2-digit" | undefined;
|
|
4419
4426
|
second?: "numeric" | "2-digit" | undefined;
|
|
4420
|
-
timeZoneName?: "long" | "
|
|
4427
|
+
timeZoneName?: "short" | "long" | "shortOffset" | "longOffset" | "shortGeneric" | "longGeneric" | undefined;
|
|
4421
4428
|
formatMatcher?: "best fit" | "basic" | undefined;
|
|
4422
4429
|
hour12?: boolean | undefined;
|
|
4423
4430
|
timeZone?: string | undefined;
|
|
@@ -4448,6 +4455,7 @@ declare namespace Intl {
|
|
|
4448
4455
|
new(locales?: string | string[], options?: DateTimeFormatOptions): DateTimeFormat;
|
|
4449
4456
|
(locales?: string | string[], options?: DateTimeFormatOptions): DateTimeFormat;
|
|
4450
4457
|
supportedLocalesOf(locales: string | string[], options?: DateTimeFormatOptions): string[];
|
|
4458
|
+
readonly prototype: DateTimeFormat;
|
|
4451
4459
|
};
|
|
4452
4460
|
}
|
|
4453
4461
|
|
package/lib/lib.esnext.intl.d.ts
CHANGED
|
@@ -19,5 +19,8 @@ and limitations under the License.
|
|
|
19
19
|
|
|
20
20
|
|
|
21
21
|
declare namespace Intl {
|
|
22
|
-
|
|
22
|
+
interface NumberFormat {
|
|
23
|
+
formatRange(start: number | bigint, end: number | bigint): string;
|
|
24
|
+
formatRangeToParts(start: number | bigint, end: number | bigint): NumberFormatPart[];
|
|
25
|
+
}
|
|
23
26
|
}
|