Skip to content

Commit 72406c6

Browse files
authored
Fix regression in WeakMap constructor type (#54592)
1 parent af07584 commit 72406c6

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

src/lib/es2015.collection.d.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ interface WeakMap<K extends WeakKey, V> {
6464
}
6565

6666
interface WeakMapConstructor {
67-
new <K extends WeakKey = WeakKey, V = any>(entries?: readonly [K, V][] | null): WeakMap<K, V>;
67+
new <K extends WeakKey = WeakKey, V = any>(entries?: readonly (readonly [K, V])[] | null): WeakMap<K, V>;
6868
readonly prototype: WeakMap<WeakKey, any>;
6969
}
7070
declare var WeakMap: WeakMapConstructor;

tests/baselines/reference/dissallowSymbolAsWeakType.errors.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ dissallowSymbolAsWeakType.ts(8,12): error TS2769: No overload matches this call.
2121
Type '[symbol, false]' is not assignable to type 'readonly [object, boolean]'.
2222
Type at position 0 in source is not compatible with type at position 0 in target.
2323
Type 'symbol' is not assignable to type 'object'.
24-
Overload 2 of 2, '(entries?: readonly [object, boolean][]): WeakMap<object, boolean>', gave the following error.
24+
Overload 2 of 2, '(entries?: readonly (readonly [object, boolean])[]): WeakMap<object, boolean>', gave the following error.
2525
Type 'symbol' is not assignable to type 'object'.
2626
dissallowSymbolAsWeakType.ts(9,8): error TS2345: Argument of type 'symbol' is not assignable to parameter of type 'object'.
2727
dissallowSymbolAsWeakType.ts(10,8): error TS2345: Argument of type 'symbol' is not assignable to parameter of type 'object'.
@@ -69,7 +69,7 @@ dissallowSymbolAsWeakType.ts(19,14): error TS2345: Argument of type 'symbol' is
6969
!!! error TS2769: Type '[symbol, false]' is not assignable to type 'readonly [object, boolean]'.
7070
!!! error TS2769: Type at position 0 in source is not compatible with type at position 0 in target.
7171
!!! error TS2769: Type 'symbol' is not assignable to type 'object'.
72-
!!! error TS2769: Overload 2 of 2, '(entries?: readonly [object, boolean][]): WeakMap<object, boolean>', gave the following error.
72+
!!! error TS2769: Overload 2 of 2, '(entries?: readonly (readonly [object, boolean])[]): WeakMap<object, boolean>', gave the following error.
7373
!!! error TS2769: Type 'symbol' is not assignable to type 'object'.
7474
wm.set(s, true);
7575
~

0 commit comments

Comments
 (0)