typescript 4.4.4 → 4.5.2

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 (42) hide show
  1. package/SECURITY.md +41 -0
  2. package/lib/cancellationToken.js +1 -1
  3. package/lib/cs/diagnosticMessages.generated.json +53 -61
  4. package/lib/de/diagnosticMessages.generated.json +56 -64
  5. package/lib/es/diagnosticMessages.generated.json +54 -62
  6. package/lib/fr/diagnosticMessages.generated.json +56 -64
  7. package/lib/it/diagnosticMessages.generated.json +56 -64
  8. package/lib/ja/diagnosticMessages.generated.json +56 -64
  9. package/lib/ko/diagnosticMessages.generated.json +53 -61
  10. package/lib/lib.dom.d.ts +854 -1987
  11. package/lib/lib.dom.iterable.d.ts +17 -55
  12. package/lib/lib.es2015.core.d.ts +53 -13
  13. package/lib/lib.es2015.iterable.d.ts +2 -10
  14. package/lib/lib.es2015.promise.d.ts +2 -74
  15. package/lib/lib.es2018.intl.d.ts +23 -11
  16. package/lib/lib.es2019.string.d.ts +8 -2
  17. package/lib/lib.es2020.intl.d.ts +173 -114
  18. package/lib/lib.es2020.promise.d.ts +2 -3
  19. package/lib/lib.es2021.d.ts +1 -0
  20. package/lib/lib.es2021.intl.d.ts +44 -0
  21. package/lib/lib.es2021.promise.d.ts +8 -1
  22. package/lib/lib.es5.d.ts +103 -43
  23. package/lib/lib.esnext.intl.d.ts +1 -10
  24. package/lib/lib.webworker.d.ts +241 -537
  25. package/lib/lib.webworker.iterable.d.ts +10 -37
  26. package/lib/pl/diagnosticMessages.generated.json +56 -64
  27. package/lib/protocol.d.ts +8 -0
  28. package/lib/pt-br/diagnosticMessages.generated.json +56 -64
  29. package/lib/ru/diagnosticMessages.generated.json +54 -62
  30. package/lib/tr/diagnosticMessages.generated.json +56 -64
  31. package/lib/tsc.js +7888 -5950
  32. package/lib/tsserver.js +13027 -9749
  33. package/lib/tsserverlibrary.d.ts +411 -287
  34. package/lib/tsserverlibrary.js +13002 -9724
  35. package/lib/typescript.d.ts +401 -285
  36. package/lib/typescript.js +12879 -9617
  37. package/lib/typescriptServices.d.ts +401 -285
  38. package/lib/typescriptServices.js +12879 -9617
  39. package/lib/typingsInstaller.js +9179 -6936
  40. package/lib/zh-cn/diagnosticMessages.generated.json +56 -64
  41. package/lib/zh-tw/diagnosticMessages.generated.json +56 -64
  42. package/package.json +5 -7
package/lib/lib.es5.d.ts CHANGED
@@ -84,12 +84,14 @@ declare function encodeURIComponent(uriComponent: string | number | boolean): st
84
84
 
85
85
  /**
86
86
  * Computes a new string in which certain characters have been replaced by a hexadecimal escape sequence.
87
+ * @deprecated A legacy feature for browser compatibility
87
88
  * @param string A string value
88
89
  */
89
90
  declare function escape(string: string): string;
90
91
 
91
92
  /**
92
93
  * Computes a new string in which hexadecimal escape sequences are replaced with the character that it represents.
94
+ * @deprecated A legacy feature for browser compatibility
93
95
  * @param string A string value
94
96
  */
95
97
  declare function unescape(string: string): string;
@@ -214,13 +216,13 @@ interface ObjectConstructor {
214
216
 
215
217
  /**
216
218
  * Prevents the modification of existing property attributes and values, and prevents the addition of new properties.
217
- * @param o Object on which to lock the attributes.
219
+ * @param a Object on which to lock the attributes.
218
220
  */
219
221
  freeze<T>(a: T[]): readonly T[];
220
222
 
221
223
  /**
222
224
  * Prevents the modification of existing property attributes and values, and prevents the addition of new properties.
223
- * @param o Object on which to lock the attributes.
225
+ * @param f Object on which to lock the attributes.
224
226
  */
225
227
  freeze<T extends Function>(f: T): T;
226
228
 
@@ -503,6 +505,7 @@ interface String {
503
505
  // IE extensions
504
506
  /**
505
507
  * Gets a substring beginning at the specified location and having the specified length.
508
+ * @deprecated A legacy feature for browser compatibility
506
509
  * @param from The starting position of the desired substring. The index of the first character in the string is zero.
507
510
  * @param length The number of characters to include in the returned substring.
508
511
  */
@@ -614,6 +617,23 @@ interface TemplateStringsArray extends ReadonlyArray<string> {
614
617
  interface ImportMeta {
615
618
  }
616
619
 
620
+ /**
621
+ * The type for the optional second argument to `import()`.
622
+ *
623
+ * If your host environment supports additional options, this type may be
624
+ * augmented via interface merging.
625
+ */
626
+ interface ImportCallOptions {
627
+ assert?: ImportAssertions;
628
+ }
629
+
630
+ /**
631
+ * The type for the `assert` property of the optional second argument to `import()`.
632
+ */
633
+ interface ImportAssertions {
634
+ [key: string]: string;
635
+ }
636
+
617
637
  interface Math {
618
638
  /** The mathematical constant e. This is Euler's number, the base of natural logarithms. */
619
639
  readonly E: number;
@@ -944,7 +964,8 @@ interface RegExp {
944
964
  lastIndex: number;
945
965
 
946
966
  // Non-standard extensions
947
- compile(): this;
967
+ /** @deprecated A legacy feature for browser compatibility */
968
+ compile(pattern: string, flags?: string): this;
948
969
  }
949
970
 
950
971
  interface RegExpConstructor {
@@ -955,16 +976,44 @@ interface RegExpConstructor {
955
976
  readonly prototype: RegExp;
956
977
 
957
978
  // Non-standard extensions
979
+ /** @deprecated A legacy feature for browser compatibility */
958
980
  $1: string;
981
+ /** @deprecated A legacy feature for browser compatibility */
959
982
  $2: string;
983
+ /** @deprecated A legacy feature for browser compatibility */
960
984
  $3: string;
985
+ /** @deprecated A legacy feature for browser compatibility */
961
986
  $4: string;
987
+ /** @deprecated A legacy feature for browser compatibility */
962
988
  $5: string;
989
+ /** @deprecated A legacy feature for browser compatibility */
963
990
  $6: string;
991
+ /** @deprecated A legacy feature for browser compatibility */
964
992
  $7: string;
993
+ /** @deprecated A legacy feature for browser compatibility */
965
994
  $8: string;
995
+ /** @deprecated A legacy feature for browser compatibility */
966
996
  $9: string;
997
+ /** @deprecated A legacy feature for browser compatibility */
998
+ input: string;
999
+ /** @deprecated A legacy feature for browser compatibility */
1000
+ $_: string;
1001
+ /** @deprecated A legacy feature for browser compatibility */
967
1002
  lastMatch: string;
1003
+ /** @deprecated A legacy feature for browser compatibility */
1004
+ "$&": string;
1005
+ /** @deprecated A legacy feature for browser compatibility */
1006
+ lastParen: string;
1007
+ /** @deprecated A legacy feature for browser compatibility */
1008
+ "$+": string;
1009
+ /** @deprecated A legacy feature for browser compatibility */
1010
+ leftContext: string;
1011
+ /** @deprecated A legacy feature for browser compatibility */
1012
+ "$`": string;
1013
+ /** @deprecated A legacy feature for browser compatibility */
1014
+ rightContext: string;
1015
+ /** @deprecated A legacy feature for browser compatibility */
1016
+ "$'": string;
968
1017
  }
969
1018
 
970
1019
  declare var RegExp: RegExpConstructor;
@@ -1281,7 +1330,7 @@ interface Array<T> {
1281
1330
  * Sorts an array in place.
1282
1331
  * This method mutates the array and returns a reference to the same array.
1283
1332
  * @param compareFn Function used to determine the order of the elements. It is expected to return
1284
- * a negative value if first argument is less than second argument, zero if they're equal and a positive
1333
+ * a negative value if the first argument is less than the second argument, zero if they're equal, and a positive
1285
1334
  * value otherwise. If omitted, the elements are sorted in ascending, ASCII character order.
1286
1335
  * ```ts
1287
1336
  * [11,2,22,1].sort((a, b) => a - b)
@@ -1460,6 +1509,17 @@ interface Promise<T> {
1460
1509
  catch<TResult = never>(onrejected?: ((reason: any) => TResult | PromiseLike<TResult>) | undefined | null): Promise<T | TResult>;
1461
1510
  }
1462
1511
 
1512
+ /**
1513
+ * Recursively unwraps the "awaited type" of a type. Non-promise "thenables" should resolve to `never`. This emulates the behavior of `await`.
1514
+ */
1515
+ type Awaited<T> =
1516
+ T extends null | undefined ? T : // special case for `null | undefined` when not in `--strictNullChecks` mode
1517
+ T extends object & { then(onfulfilled: infer F): any } ? // `await` only unwraps object types with a callable `then`. Non-object types are not unwrapped
1518
+ F extends ((value: infer V) => any) ? // if the argument to `then` is callable, extracts the argument
1519
+ Awaited<V> : // recursively unwrap the value
1520
+ never : // the argument to `then` was not callable
1521
+ T; // non-object or non-thenable
1522
+
1463
1523
  interface ArrayLike<T> {
1464
1524
  readonly length: number;
1465
1525
  readonly [n: number]: T;
@@ -1966,7 +2026,7 @@ interface Int8Array {
1966
2026
  * Sorts an array.
1967
2027
  * @param compareFn Function used to determine the order of the elements. It is expected to return
1968
2028
  * a negative value if first argument is less than second argument, zero if they're equal and a positive
1969
- * value otherwise. If omitted, the elements are sorted in ascending, ASCII character order.
2029
+ * value otherwise. If omitted, the elements are sorted in ascending order.
1970
2030
  * ```ts
1971
2031
  * [11,2,22,1].sort((a, b) => a - b)
1972
2032
  * ```
@@ -2248,7 +2308,7 @@ interface Uint8Array {
2248
2308
  * Sorts an array.
2249
2309
  * @param compareFn Function used to determine the order of the elements. It is expected to return
2250
2310
  * a negative value if first argument is less than second argument, zero if they're equal and a positive
2251
- * value otherwise. If omitted, the elements are sorted in ascending, ASCII character order.
2311
+ * value otherwise. If omitted, the elements are sorted in ascending order.
2252
2312
  * ```ts
2253
2313
  * [11,2,22,1].sort((a, b) => a - b)
2254
2314
  * ```
@@ -2530,7 +2590,7 @@ interface Uint8ClampedArray {
2530
2590
  * Sorts an array.
2531
2591
  * @param compareFn Function used to determine the order of the elements. It is expected to return
2532
2592
  * a negative value if first argument is less than second argument, zero if they're equal and a positive
2533
- * value otherwise. If omitted, the elements are sorted in ascending, ASCII character order.
2593
+ * value otherwise. If omitted, the elements are sorted in ascending order.
2534
2594
  * ```ts
2535
2595
  * [11,2,22,1].sort((a, b) => a - b)
2536
2596
  * ```
@@ -2810,7 +2870,7 @@ interface Int16Array {
2810
2870
  * Sorts an array.
2811
2871
  * @param compareFn Function used to determine the order of the elements. It is expected to return
2812
2872
  * a negative value if first argument is less than second argument, zero if they're equal and a positive
2813
- * value otherwise. If omitted, the elements are sorted in ascending, ASCII character order.
2873
+ * value otherwise. If omitted, the elements are sorted in ascending order.
2814
2874
  * ```ts
2815
2875
  * [11,2,22,1].sort((a, b) => a - b)
2816
2876
  * ```
@@ -3093,7 +3153,7 @@ interface Uint16Array {
3093
3153
  * Sorts an array.
3094
3154
  * @param compareFn Function used to determine the order of the elements. It is expected to return
3095
3155
  * a negative value if first argument is less than second argument, zero if they're equal and a positive
3096
- * value otherwise. If omitted, the elements are sorted in ascending, ASCII character order.
3156
+ * value otherwise. If omitted, the elements are sorted in ascending order.
3097
3157
  * ```ts
3098
3158
  * [11,2,22,1].sort((a, b) => a - b)
3099
3159
  * ```
@@ -3375,7 +3435,7 @@ interface Int32Array {
3375
3435
  * Sorts an array.
3376
3436
  * @param compareFn Function used to determine the order of the elements. It is expected to return
3377
3437
  * a negative value if first argument is less than second argument, zero if they're equal and a positive
3378
- * value otherwise. If omitted, the elements are sorted in ascending, ASCII character order.
3438
+ * value otherwise. If omitted, the elements are sorted in ascending order.
3379
3439
  * ```ts
3380
3440
  * [11,2,22,1].sort((a, b) => a - b)
3381
3441
  * ```
@@ -3656,7 +3716,7 @@ interface Uint32Array {
3656
3716
  * Sorts an array.
3657
3717
  * @param compareFn Function used to determine the order of the elements. It is expected to return
3658
3718
  * a negative value if first argument is less than second argument, zero if they're equal and a positive
3659
- * value otherwise. If omitted, the elements are sorted in ascending, ASCII character order.
3719
+ * value otherwise. If omitted, the elements are sorted in ascending order.
3660
3720
  * ```ts
3661
3721
  * [11,2,22,1].sort((a, b) => a - b)
3662
3722
  * ```
@@ -3938,7 +3998,7 @@ interface Float32Array {
3938
3998
  * Sorts an array.
3939
3999
  * @param compareFn Function used to determine the order of the elements. It is expected to return
3940
4000
  * a negative value if first argument is less than second argument, zero if they're equal and a positive
3941
- * value otherwise. If omitted, the elements are sorted in ascending, ASCII character order.
4001
+ * value otherwise. If omitted, the elements are sorted in ascending order.
3942
4002
  * ```ts
3943
4003
  * [11,2,22,1].sort((a, b) => a - b)
3944
4004
  * ```
@@ -4221,7 +4281,7 @@ interface Float64Array {
4221
4281
  * Sorts an array.
4222
4282
  * @param compareFn Function used to determine the order of the elements. It is expected to return
4223
4283
  * a negative value if first argument is less than second argument, zero if they're equal and a positive
4224
- * value otherwise. If omitted, the elements are sorted in ascending, ASCII character order.
4284
+ * value otherwise. If omitted, the elements are sorted in ascending order.
4225
4285
  * ```ts
4226
4286
  * [11,2,22,1].sort((a, b) => a - b)
4227
4287
  * ```
@@ -4283,12 +4343,12 @@ declare var Float64Array: Float64ArrayConstructor;
4283
4343
 
4284
4344
  declare namespace Intl {
4285
4345
  interface CollatorOptions {
4286
- usage?: string;
4287
- localeMatcher?: string;
4288
- numeric?: boolean;
4289
- caseFirst?: string;
4290
- sensitivity?: string;
4291
- ignorePunctuation?: boolean;
4346
+ usage?: string | undefined;
4347
+ localeMatcher?: string | undefined;
4348
+ numeric?: boolean | undefined;
4349
+ caseFirst?: string | undefined;
4350
+ sensitivity?: string | undefined;
4351
+ ignorePunctuation?: boolean | undefined;
4292
4352
  }
4293
4353
 
4294
4354
  interface ResolvedCollatorOptions {
@@ -4312,17 +4372,17 @@ declare namespace Intl {
4312
4372
  };
4313
4373
 
4314
4374
  interface NumberFormatOptions {
4315
- localeMatcher?: string;
4316
- style?: string;
4317
- currency?: string;
4318
- currencyDisplay?: string;
4319
- currencySign?: string;
4320
- useGrouping?: boolean;
4321
- minimumIntegerDigits?: number;
4322
- minimumFractionDigits?: number;
4323
- maximumFractionDigits?: number;
4324
- minimumSignificantDigits?: number;
4325
- maximumSignificantDigits?: number;
4375
+ localeMatcher?: string | undefined;
4376
+ style?: string | undefined;
4377
+ currency?: string | undefined;
4378
+ currencyDisplay?: string | undefined;
4379
+ currencySign?: string | undefined;
4380
+ useGrouping?: boolean | undefined;
4381
+ minimumIntegerDigits?: number | undefined;
4382
+ minimumFractionDigits?: number | undefined;
4383
+ maximumFractionDigits?: number | undefined;
4384
+ minimumSignificantDigits?: number | undefined;
4385
+ maximumSignificantDigits?: number | undefined;
4326
4386
  }
4327
4387
 
4328
4388
  interface ResolvedNumberFormatOptions {
@@ -4350,19 +4410,19 @@ declare namespace Intl {
4350
4410
  };
4351
4411
 
4352
4412
  interface DateTimeFormatOptions {
4353
- localeMatcher?: "best fit" | "lookup";
4354
- weekday?: "long" | "short" | "narrow";
4355
- era?: "long" | "short" | "narrow";
4356
- year?: "numeric" | "2-digit";
4357
- month?: "numeric" | "2-digit" | "long" | "short" | "narrow";
4358
- day?: "numeric" | "2-digit";
4359
- hour?: "numeric" | "2-digit";
4360
- minute?: "numeric" | "2-digit";
4361
- second?: "numeric" | "2-digit";
4362
- timeZoneName?: "long" | "short";
4363
- formatMatcher?: "best fit" | "basic";
4364
- hour12?: boolean;
4365
- timeZone?: string;
4413
+ localeMatcher?: "best fit" | "lookup" | undefined;
4414
+ weekday?: "long" | "short" | "narrow" | undefined;
4415
+ era?: "long" | "short" | "narrow" | undefined;
4416
+ year?: "numeric" | "2-digit" | undefined;
4417
+ month?: "numeric" | "2-digit" | "long" | "short" | "narrow" | undefined;
4418
+ day?: "numeric" | "2-digit" | undefined;
4419
+ hour?: "numeric" | "2-digit" | undefined;
4420
+ minute?: "numeric" | "2-digit" | undefined;
4421
+ second?: "numeric" | "2-digit" | undefined;
4422
+ timeZoneName?: "long" | "short" | undefined;
4423
+ formatMatcher?: "best fit" | "basic" | undefined;
4424
+ hour12?: boolean | undefined;
4425
+ timeZone?: string | undefined;
4366
4426
  }
4367
4427
 
4368
4428
  interface ResolvedDateTimeFormatOptions {
@@ -19,14 +19,5 @@ and limitations under the License.
19
19
 
20
20
 
21
21
  declare namespace Intl {
22
- type NumberFormatPartTypes = "compact" | "currency" | "decimal" | "exponentInteger" | "exponentMinusSign" | "exponentSeparator" | "fraction" | "group" | "infinity" | "integer" | "literal" | "minusSign" | "nan" | "plusSign" | "percentSign" | "unit" | "unknown";
23
-
24
- interface NumberFormatPart {
25
- type: NumberFormatPartTypes;
26
- value: string;
27
- }
28
-
29
- interface NumberFormat {
30
- formatToParts(number?: number | bigint): NumberFormatPart[];
31
- }
22
+ // Empty for now
32
23
  }