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.
@@ -60,7 +60,7 @@ interface ReadonlyMap<K, V> {
60
60
  readonly size: number;
61
61
  }
62
62
 
63
- interface WeakMap<K extends object, V> {
63
+ interface WeakMap<K extends WeakKey, V> {
64
64
  /**
65
65
  * Removes the specified element from the WeakMap.
66
66
  * @returns true if the element was successfully removed, or false if it was not present.
@@ -76,14 +76,14 @@ interface WeakMap<K extends object, V> {
76
76
  has(key: K): boolean;
77
77
  /**
78
78
  * Adds a new element with a specified key and value.
79
- * @param key Must be an object.
79
+ * @param key Must be an object or symbol.
80
80
  */
81
81
  set(key: K, value: V): this;
82
82
  }
83
83
 
84
84
  interface WeakMapConstructor {
85
- new <K extends object = object, V = any>(entries?: readonly (readonly [K, V])[] | null): WeakMap<K, V>;
86
- readonly prototype: WeakMap<object, any>;
85
+ new <K extends WeakKey = WeakKey, V = any>(entries?: readonly (readonly [K, V])[] | null): WeakMap<K, V>;
86
+ readonly prototype: WeakMap<WeakKey, any>;
87
87
  }
88
88
  declare var WeakMap: WeakMapConstructor;
89
89
 
@@ -125,9 +125,9 @@ interface ReadonlySet<T> {
125
125
  readonly size: number;
126
126
  }
127
127
 
128
- interface WeakSet<T extends object> {
128
+ interface WeakSet<T extends WeakKey> {
129
129
  /**
130
- * Appends a new object to the end of the WeakSet.
130
+ * Appends a new value to the end of the WeakSet.
131
131
  */
132
132
  add(value: T): this;
133
133
  /**
@@ -136,13 +136,13 @@ interface WeakSet<T extends object> {
136
136
  */
137
137
  delete(value: T): boolean;
138
138
  /**
139
- * @returns a boolean indicating whether an object exists in the WeakSet or not.
139
+ * @returns a boolean indicating whether a value exists in the WeakSet or not.
140
140
  */
141
141
  has(value: T): boolean;
142
142
  }
143
143
 
144
144
  interface WeakSetConstructor {
145
- new <T extends object = object>(values?: readonly T[] | null): WeakSet<T>;
146
- readonly prototype: WeakSet<object>;
145
+ new <T extends WeakKey = WeakKey>(values?: readonly T[] | null): WeakSet<T>;
146
+ readonly prototype: WeakSet<WeakKey>;
147
147
  }
148
148
  declare var WeakSet: WeakSetConstructor;
@@ -56,10 +56,10 @@ interface Array<T> {
56
56
  * @param target If target is negative, it is treated as length+target where length is the
57
57
  * length of the array.
58
58
  * @param start If start is negative, it is treated as length+start. If end is negative, it
59
- * is treated as length+end. If start is omitted, `0` is used.
59
+ * is treated as length+end.
60
60
  * @param end If not specified, length of the this object is used as its default value.
61
61
  */
62
- copyWithin(target: number, start?: number, end?: number): this;
62
+ copyWithin(target: number, start: number, end?: number): this;
63
63
  }
64
64
 
65
65
  interface ArrayConstructor {
@@ -159,10 +159,10 @@ interface MapConstructor {
159
159
  new <K, V>(iterable?: Iterable<readonly [K, V]> | null): Map<K, V>;
160
160
  }
161
161
 
162
- interface WeakMap<K extends object, V> { }
162
+ interface WeakMap<K extends WeakKey, V> { }
163
163
 
164
164
  interface WeakMapConstructor {
165
- new <K extends object, V>(iterable: Iterable<readonly [K, V]>): WeakMap<K, V>;
165
+ new <K extends WeakKey, V>(iterable: Iterable<readonly [K, V]>): WeakMap<K, V>;
166
166
  }
167
167
 
168
168
  interface Set<T> {
@@ -207,10 +207,10 @@ interface SetConstructor {
207
207
  new <T>(iterable?: Iterable<T> | null): Set<T>;
208
208
  }
209
209
 
210
- interface WeakSet<T extends object> { }
210
+ interface WeakSet<T extends WeakKey> { }
211
211
 
212
212
  interface WeakSetConstructor {
213
- new <T extends object = object>(iterable: Iterable<T>): WeakSet<T>;
213
+ new <T extends WeakKey = WeakKey>(iterable: Iterable<T>): WeakSet<T>;
214
214
  }
215
215
 
216
216
  interface Promise<T> { }
@@ -137,7 +137,7 @@ interface Map<K, V> {
137
137
  readonly [Symbol.toStringTag]: string;
138
138
  }
139
139
 
140
- interface WeakMap<K extends object, V> {
140
+ interface WeakMap<K extends WeakKey, V> {
141
141
  readonly [Symbol.toStringTag]: string;
142
142
  }
143
143
 
@@ -145,7 +145,7 @@ interface Set<T> {
145
145
  readonly [Symbol.toStringTag]: string;
146
146
  }
147
147
 
148
- interface WeakSet<T extends object> {
148
+ interface WeakSet<T extends WeakKey> {
149
149
  readonly [Symbol.toStringTag]: string;
150
150
  }
151
151
 
@@ -22,3 +22,4 @@ and limitations under the License.
22
22
  /// <reference lib="es2017.string" />
23
23
  /// <reference lib="es2017.intl" />
24
24
  /// <reference lib="es2017.typedarrays" />
25
+ /// <reference lib="es2017.date" />
@@ -0,0 +1,31 @@
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 DateConstructor {
20
+ /**
21
+ * Returns the number of milliseconds between midnight, January 1, 1970 Universal Coordinated Time (UTC) (or GMT) and the specified date.
22
+ * @param year The full year designation is required for cross-century date accuracy. If year is between 0 and 99 is used, then year is assumed to be 1900 + year.
23
+ * @param monthIndex The month as a number between 0 and 11 (January to December).
24
+ * @param date The date as a number between 1 and 31.
25
+ * @param hours Must be supplied if minutes is supplied. A number from 0 to 23 (midnight to 11pm) that specifies the hour.
26
+ * @param minutes Must be supplied if seconds is supplied. A number from 0 to 59 that specifies the minutes.
27
+ * @param seconds Must be supplied if milliseconds is supplied. A number from 0 to 59 that specifies the seconds.
28
+ * @param ms A number from 0 to 999 that specifies the milliseconds.
29
+ */
30
+ UTC(year: number, monthIndex?: number, date?: number, hours?: number, minutes?: number, seconds?: number, ms?: number): number;
31
+ }
@@ -165,10 +165,10 @@ interface BigInt64Array {
165
165
  * @param target If target is negative, it is treated as length+target where length is the
166
166
  * length of the array.
167
167
  * @param start If start is negative, it is treated as length+start. If end is negative, it
168
- * is treated as length+end. If start is omitted, `0` is used.
168
+ * is treated as length+end.
169
169
  * @param end If not specified, length of the this object is used as its default value.
170
170
  */
171
- copyWithin(target: number, start?: number, end?: number): this;
171
+ copyWithin(target: number, start: number, end?: number): this;
172
172
 
173
173
  /** Yields index, value pairs for every entry in the array. */
174
174
  entries(): IterableIterator<[number, bigint]>;
@@ -437,10 +437,10 @@ interface BigUint64Array {
437
437
  * @param target If target is negative, it is treated as length+target where length is the
438
438
  * length of the array.
439
439
  * @param start If start is negative, it is treated as length+start. If end is negative, it
440
- * is treated as length+end. If start is omitted, `0` is used.
440
+ * is treated as length+end.
441
441
  * @param end If not specified, length of the this object is used as its default value.
442
442
  */
443
- copyWithin(target: number, start?: number, end?: number): this;
443
+ copyWithin(target: number, start: number, end?: number): this;
444
444
 
445
445
  /** Yields index, value pairs for every entry in the array. */
446
446
  entries(): IterableIterator<[number, bigint]>;
@@ -16,12 +16,13 @@ and limitations under the License.
16
16
 
17
17
  /// <reference no-default-lib="true"/>
18
18
 
19
- interface WeakRef<T extends object> {
19
+ interface WeakRef<T extends WeakKey> {
20
20
  readonly [Symbol.toStringTag]: "WeakRef";
21
21
 
22
22
  /**
23
- * Returns the WeakRef instance's target object, or undefined if the target object has been
23
+ * Returns the WeakRef instance's target value, or undefined if the target value has been
24
24
  * reclaimed.
25
+ * In es2023 the value can be either a symbol or an object, in previous versions only object is permissible.
25
26
  */
26
27
  deref(): T | undefined;
27
28
  }
@@ -30,10 +31,11 @@ interface WeakRefConstructor {
30
31
  readonly prototype: WeakRef<any>;
31
32
 
32
33
  /**
33
- * Creates a WeakRef instance for the given target object.
34
- * @param target The target object for the WeakRef instance.
34
+ * Creates a WeakRef instance for the given target value.
35
+ * In es2023 the value can be either a symbol or an object, in previous versions only object is permissible.
36
+ * @param target The target value for the WeakRef instance.
35
37
  */
36
- new<T extends object>(target: T): WeakRef<T>;
38
+ new<T extends WeakKey>(target: T): WeakRef<T>;
37
39
  }
38
40
 
39
41
  declare var WeakRef: WeakRefConstructor;
@@ -42,22 +44,23 @@ interface FinalizationRegistry<T> {
42
44
  readonly [Symbol.toStringTag]: "FinalizationRegistry";
43
45
 
44
46
  /**
45
- * Registers an object with the registry.
46
- * @param target The target object to register.
47
- * @param heldValue The value to pass to the finalizer for this object. This cannot be the
48
- * target object.
47
+ * Registers a value with the registry.
48
+ * In es2023 the value can be either a symbol or an object, in previous versions only object is permissible.
49
+ * @param target The target value to register.
50
+ * @param heldValue The value to pass to the finalizer for this value. This cannot be the
51
+ * target value.
49
52
  * @param unregisterToken The token to pass to the unregister method to unregister the target
50
- * object. If provided (and not undefined), this must be an object. If not provided, the target
51
- * cannot be unregistered.
53
+ * value. If not provided, the target cannot be unregistered.
52
54
  */
53
- register(target: object, heldValue: T, unregisterToken?: object): void;
55
+ register(target: WeakKey, heldValue: T, unregisterToken?: WeakKey): void;
54
56
 
55
57
  /**
56
- * Unregisters an object from the registry.
58
+ * Unregisters a value from the registry.
59
+ * In es2023 the value can be either a symbol or an object, in previous versions only object is permissible.
57
60
  * @param unregisterToken The token that was used as the unregisterToken argument when calling
58
- * register to register the target object.
61
+ * register to register the target value.
59
62
  */
60
- unregister(unregisterToken: object): void;
63
+ unregister(unregisterToken: WeakKey): void;
61
64
  }
62
65
 
63
66
  interface FinalizationRegistryConstructor {
@@ -65,7 +68,7 @@ interface FinalizationRegistryConstructor {
65
68
 
66
69
  /**
67
70
  * Creates a finalization registry with an associated cleanup callback
68
- * @param cleanupCallback The callback to call after an object in the registry has been reclaimed.
71
+ * @param cleanupCallback The callback to call after a value in the registry has been reclaimed.
69
72
  */
70
73
  new<T>(cleanupCallback: (heldValue: T) => void): FinalizationRegistry<T>;
71
74
  }