typescript 5.1.6 → 5.2.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.
@@ -0,0 +1,21 @@
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
+ /// <reference no-default-lib="true"/>
18
+
19
+ interface WeakKeyTypes {
20
+ symbol: symbol;
21
+ }
@@ -18,3 +18,4 @@ and limitations under the License.
18
18
 
19
19
  /// <reference lib="es2022" />
20
20
  /// <reference lib="es2023.array" />
21
+ /// <reference lib="es2023.collection" />
package/lib/lib.es5.d.ts CHANGED
@@ -1665,6 +1665,15 @@ type Uncapitalize<S extends string> = intrinsic;
1665
1665
  */
1666
1666
  interface ThisType<T> { }
1667
1667
 
1668
+ /**
1669
+ * Stores types to be used with WeakSet, WeakMap, WeakRef, and FinalizationRegistry
1670
+ */
1671
+ interface WeakKeyTypes {
1672
+ object: object;
1673
+ }
1674
+
1675
+ type WeakKey = WeakKeyTypes[keyof WeakKeyTypes];
1676
+
1668
1677
  /**
1669
1678
  * Represents a raw buffer of binary data, which is used to store data for the
1670
1679
  * different typed arrays. ArrayBuffers cannot be read from or written to directly,
@@ -1880,10 +1889,10 @@ interface Int8Array {
1880
1889
  * @param target If target is negative, it is treated as length+target where length is the
1881
1890
  * length of the array.
1882
1891
  * @param start If start is negative, it is treated as length+start. If end is negative, it
1883
- * is treated as length+end. If start is omitted, `0` is used.
1892
+ * is treated as length+end.
1884
1893
  * @param end If not specified, length of the this object is used as its default value.
1885
1894
  */
1886
- copyWithin(target: number, start?: number, end?: number): this;
1895
+ copyWithin(target: number, start: number, end?: number): this;
1887
1896
 
1888
1897
  /**
1889
1898
  * Determines whether all the members of an array satisfy the specified test.
@@ -2162,10 +2171,10 @@ interface Uint8Array {
2162
2171
  * @param target If target is negative, it is treated as length+target where length is the
2163
2172
  * length of the array.
2164
2173
  * @param start If start is negative, it is treated as length+start. If end is negative, it
2165
- * is treated as length+end. If start is omitted, `0` is used.
2174
+ * is treated as length+end.
2166
2175
  * @param end If not specified, length of the this object is used as its default value.
2167
2176
  */
2168
- copyWithin(target: number, start?: number, end?: number): this;
2177
+ copyWithin(target: number, start: number, end?: number): this;
2169
2178
 
2170
2179
  /**
2171
2180
  * Determines whether all the members of an array satisfy the specified test.
@@ -2444,10 +2453,10 @@ interface Uint8ClampedArray {
2444
2453
  * @param target If target is negative, it is treated as length+target where length is the
2445
2454
  * length of the array.
2446
2455
  * @param start If start is negative, it is treated as length+start. If end is negative, it
2447
- * is treated as length+end. If start is omitted, `0` is used.
2456
+ * is treated as length+end.
2448
2457
  * @param end If not specified, length of the this object is used as its default value.
2449
2458
  */
2450
- copyWithin(target: number, start?: number, end?: number): this;
2459
+ copyWithin(target: number, start: number, end?: number): this;
2451
2460
 
2452
2461
  /**
2453
2462
  * Determines whether all the members of an array satisfy the specified test.
@@ -2725,10 +2734,10 @@ interface Int16Array {
2725
2734
  * @param target If target is negative, it is treated as length+target where length is the
2726
2735
  * length of the array.
2727
2736
  * @param start If start is negative, it is treated as length+start. If end is negative, it
2728
- * is treated as length+end. If start is omitted, `0` is used.
2737
+ * is treated as length+end.
2729
2738
  * @param end If not specified, length of the this object is used as its default value.
2730
2739
  */
2731
- copyWithin(target: number, start?: number, end?: number): this;
2740
+ copyWithin(target: number, start: number, end?: number): this;
2732
2741
 
2733
2742
  /**
2734
2743
  * Determines whether all the members of an array satisfy the specified test.
@@ -3007,10 +3016,10 @@ interface Uint16Array {
3007
3016
  * @param target If target is negative, it is treated as length+target where length is the
3008
3017
  * length of the array.
3009
3018
  * @param start If start is negative, it is treated as length+start. If end is negative, it
3010
- * is treated as length+end. If start is omitted, `0` is used.
3019
+ * is treated as length+end.
3011
3020
  * @param end If not specified, length of the this object is used as its default value.
3012
3021
  */
3013
- copyWithin(target: number, start?: number, end?: number): this;
3022
+ copyWithin(target: number, start: number, end?: number): this;
3014
3023
 
3015
3024
  /**
3016
3025
  * Determines whether all the members of an array satisfy the specified test.
@@ -3289,10 +3298,10 @@ interface Int32Array {
3289
3298
  * @param target If target is negative, it is treated as length+target where length is the
3290
3299
  * length of the array.
3291
3300
  * @param start If start is negative, it is treated as length+start. If end is negative, it
3292
- * is treated as length+end. If start is omitted, `0` is used.
3301
+ * is treated as length+end.
3293
3302
  * @param end If not specified, length of the this object is used as its default value.
3294
3303
  */
3295
- copyWithin(target: number, start?: number, end?: number): this;
3304
+ copyWithin(target: number, start: number, end?: number): this;
3296
3305
 
3297
3306
  /**
3298
3307
  * Determines whether all the members of an array satisfy the specified test.
@@ -3571,10 +3580,10 @@ interface Uint32Array {
3571
3580
  * @param target If target is negative, it is treated as length+target where length is the
3572
3581
  * length of the array.
3573
3582
  * @param start If start is negative, it is treated as length+start. If end is negative, it
3574
- * is treated as length+end. If start is omitted, `0` is used.
3583
+ * is treated as length+end.
3575
3584
  * @param end If not specified, length of the this object is used as its default value.
3576
3585
  */
3577
- copyWithin(target: number, start?: number, end?: number): this;
3586
+ copyWithin(target: number, start: number, end?: number): this;
3578
3587
 
3579
3588
  /**
3580
3589
  * Determines whether all the members of an array satisfy the specified test.
@@ -3852,10 +3861,10 @@ interface Float32Array {
3852
3861
  * @param target If target is negative, it is treated as length+target where length is the
3853
3862
  * length of the array.
3854
3863
  * @param start If start is negative, it is treated as length+start. If end is negative, it
3855
- * is treated as length+end. If start is omitted, `0` is used.
3864
+ * is treated as length+end.
3856
3865
  * @param end If not specified, length of the this object is used as its default value.
3857
3866
  */
3858
- copyWithin(target: number, start?: number, end?: number): this;
3867
+ copyWithin(target: number, start: number, end?: number): this;
3859
3868
 
3860
3869
  /**
3861
3870
  * Determines whether all the members of an array satisfy the specified test.
@@ -4135,10 +4144,10 @@ interface Float64Array {
4135
4144
  * @param target If target is negative, it is treated as length+target where length is the
4136
4145
  * length of the array.
4137
4146
  * @param start If start is negative, it is treated as length+start. If end is negative, it
4138
- * is treated as length+end. If start is omitted, `0` is used.
4147
+ * is treated as length+end.
4139
4148
  * @param end If not specified, length of the this object is used as its default value.
4140
4149
  */
4141
- copyWithin(target: number, start?: number, end?: number): this;
4150
+ copyWithin(target: number, start: number, end?: number): this;
4142
4151
 
4143
4152
  /**
4144
4153
  * Determines whether all the members of an array satisfy the specified test.
@@ -18,3 +18,5 @@ and limitations under the License.
18
18
 
19
19
  /// <reference lib="es2023" />
20
20
  /// <reference lib="esnext.intl" />
21
+ /// <reference lib="esnext.decorators" />
22
+ /// <reference lib="esnext.disposable" />
@@ -0,0 +1,28 @@
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
+ /// <reference no-default-lib="true"/>
18
+
19
+ /// <reference lib="es2015.symbol" />
20
+ /// <reference lib="decorators" />
21
+
22
+ interface SymbolConstructor {
23
+ readonly metadata: unique symbol;
24
+ }
25
+
26
+ interface Function {
27
+ [Symbol.metadata]: DecoratorMetadata | null;
28
+ }
@@ -0,0 +1,185 @@
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
+ /// <reference no-default-lib="true"/>
18
+
19
+ /// <reference lib="es2015.symbol" />
20
+
21
+ interface SymbolConstructor {
22
+ /**
23
+ * A method that is used to release resources held by an object. Called by the semantics of the `using` statement.
24
+ */
25
+ readonly dispose: unique symbol;
26
+
27
+ /**
28
+ * A method that is used to asynchronously release resources held by an object. Called by the semantics of the `await using` statement.
29
+ */
30
+ readonly asyncDispose: unique symbol;
31
+ }
32
+
33
+ interface Disposable {
34
+ [Symbol.dispose](): void;
35
+ }
36
+
37
+ interface AsyncDisposable {
38
+ [Symbol.asyncDispose](): PromiseLike<void>;
39
+ }
40
+
41
+ interface SuppressedError extends Error {
42
+ error: any;
43
+ suppressed: any;
44
+ }
45
+
46
+ interface SuppressedErrorConstructor extends ErrorConstructor {
47
+ new (error: any, suppressed: any, message?: string): SuppressedError;
48
+ (error: any, suppressed: any, message?: string): SuppressedError;
49
+ readonly prototype: SuppressedError;
50
+ }
51
+ declare var SuppressedError: SuppressedErrorConstructor;
52
+
53
+ interface DisposableStack {
54
+ /**
55
+ * Returns a value indicating whether this stack has been disposed.
56
+ */
57
+ readonly disposed: boolean;
58
+ /**
59
+ * Disposes each resource in the stack in the reverse order that they were added.
60
+ */
61
+ dispose(): void;
62
+ /**
63
+ * Adds a disposable resource to the stack, returning the resource.
64
+ * @param value The resource to add. `null` and `undefined` will not be added, but will be returned.
65
+ * @returns The provided {@link value}.
66
+ */
67
+ use<T extends Disposable | null | undefined>(value: T): T;
68
+ /**
69
+ * Adds a value and associated disposal callback as a resource to the stack.
70
+ * @param value The value to add.
71
+ * @param onDispose The callback to use in place of a `[Symbol.dispose]()` method. Will be invoked with `value`
72
+ * as the first parameter.
73
+ * @returns The provided {@link value}.
74
+ */
75
+ adopt<T>(value: T, onDispose: (value: T) => void): T;
76
+ /**
77
+ * Adds a callback to be invoked when the stack is disposed.
78
+ */
79
+ defer(onDispose: () => void): void;
80
+ /**
81
+ * Move all resources out of this stack and into a new `DisposableStack`, and marks this stack as disposed.
82
+ * @example
83
+ * ```ts
84
+ * class C {
85
+ * #res1: Disposable;
86
+ * #res2: Disposable;
87
+ * #disposables: DisposableStack;
88
+ * constructor() {
89
+ * // stack will be disposed when exiting constructor for any reason
90
+ * using stack = new DisposableStack();
91
+ *
92
+ * // get first resource
93
+ * this.#res1 = stack.use(getResource1());
94
+ *
95
+ * // get second resource. If this fails, both `stack` and `#res1` will be disposed.
96
+ * this.#res2 = stack.use(getResource2());
97
+ *
98
+ * // all operations succeeded, move resources out of `stack` so that they aren't disposed
99
+ * // when constructor exits
100
+ * this.#disposables = stack.move();
101
+ * }
102
+ *
103
+ * [Symbol.dispose]() {
104
+ * this.#disposables.dispose();
105
+ * }
106
+ * }
107
+ * ```
108
+ */
109
+ move(): DisposableStack;
110
+ [Symbol.dispose](): void;
111
+ readonly [Symbol.toStringTag]: string;
112
+ }
113
+
114
+ interface DisposableStackConstructor {
115
+ new(): DisposableStack;
116
+ readonly prototype: DisposableStack;
117
+ }
118
+ declare var DisposableStack: DisposableStackConstructor;
119
+
120
+ interface AsyncDisposableStack {
121
+ /**
122
+ * Returns a value indicating whether this stack has been disposed.
123
+ */
124
+ readonly disposed: boolean;
125
+ /**
126
+ * Disposes each resource in the stack in the reverse order that they were added.
127
+ */
128
+ disposeAsync(): Promise<void>;
129
+ /**
130
+ * Adds a disposable resource to the stack, returning the resource.
131
+ * @param value The resource to add. `null` and `undefined` will not be added, but will be returned.
132
+ * @returns The provided {@link value}.
133
+ */
134
+ use<T extends AsyncDisposable | Disposable | null | undefined>(value: T): T;
135
+ /**
136
+ * Adds a value and associated disposal callback as a resource to the stack.
137
+ * @param value The value to add.
138
+ * @param onDisposeAsync The callback to use in place of a `[Symbol.asyncDispose]()` method. Will be invoked with `value`
139
+ * as the first parameter.
140
+ * @returns The provided {@link value}.
141
+ */
142
+ adopt<T>(value: T, onDisposeAsync: (value: T) => PromiseLike<void> | void): T;
143
+ /**
144
+ * Adds a callback to be invoked when the stack is disposed.
145
+ */
146
+ defer(onDisposeAsync: () => PromiseLike<void> | void): void;
147
+ /**
148
+ * Move all resources out of this stack and into a new `DisposableStack`, and marks this stack as disposed.
149
+ * @example
150
+ * ```ts
151
+ * class C {
152
+ * #res1: Disposable;
153
+ * #res2: Disposable;
154
+ * #disposables: DisposableStack;
155
+ * constructor() {
156
+ * // stack will be disposed when exiting constructor for any reason
157
+ * using stack = new DisposableStack();
158
+ *
159
+ * // get first resource
160
+ * this.#res1 = stack.use(getResource1());
161
+ *
162
+ * // get second resource. If this fails, both `stack` and `#res1` will be disposed.
163
+ * this.#res2 = stack.use(getResource2());
164
+ *
165
+ * // all operations succeeded, move resources out of `stack` so that they aren't disposed
166
+ * // when constructor exits
167
+ * this.#disposables = stack.move();
168
+ * }
169
+ *
170
+ * [Symbol.dispose]() {
171
+ * this.#disposables.dispose();
172
+ * }
173
+ * }
174
+ * ```
175
+ */
176
+ move(): AsyncDisposableStack;
177
+ [Symbol.asyncDispose](): Promise<void>;
178
+ readonly [Symbol.toStringTag]: string;
179
+ }
180
+
181
+ interface AsyncDisposableStackConstructor {
182
+ new(): AsyncDisposableStack;
183
+ readonly prototype: AsyncDisposableStack;
184
+ }
185
+ declare var AsyncDisposableStack: AsyncDisposableStackConstructor;