Skip to content

Fix regression in WeakMap constructor type #54592

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 9, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/lib/es2015.collection.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ interface WeakMap<K extends WeakKey, V> {
}

interface WeakMapConstructor {
new <K extends WeakKey = WeakKey, V = any>(entries?: readonly [K, V][] | null): WeakMap<K, V>;
new <K extends WeakKey = WeakKey, V = any>(entries?: readonly (readonly [K, V])[] | null): WeakMap<K, V>;
readonly prototype: WeakMap<WeakKey, any>;
}
declare var WeakMap: WeakMapConstructor;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ dissallowSymbolAsWeakType.ts(8,12): error TS2769: No overload matches this call.
Type '[symbol, false]' is not assignable to type 'readonly [object, boolean]'.
Type at position 0 in source is not compatible with type at position 0 in target.
Type 'symbol' is not assignable to type 'object'.
Overload 2 of 2, '(entries?: readonly [object, boolean][]): WeakMap<object, boolean>', gave the following error.
Overload 2 of 2, '(entries?: readonly (readonly [object, boolean])[]): WeakMap<object, boolean>', gave the following error.
Type 'symbol' is not assignable to type 'object'.
dissallowSymbolAsWeakType.ts(9,8): error TS2345: Argument of type 'symbol' is not assignable to parameter of type 'object'.
dissallowSymbolAsWeakType.ts(10,8): error TS2345: Argument of type 'symbol' is not assignable to parameter of type 'object'.
Expand Down Expand Up @@ -69,7 +69,7 @@ dissallowSymbolAsWeakType.ts(19,14): error TS2345: Argument of type 'symbol' is
!!! error TS2769: Type '[symbol, false]' is not assignable to type 'readonly [object, boolean]'.
!!! error TS2769: Type at position 0 in source is not compatible with type at position 0 in target.
!!! error TS2769: Type 'symbol' is not assignable to type 'object'.
!!! error TS2769: Overload 2 of 2, '(entries?: readonly [object, boolean][]): WeakMap<object, boolean>', gave the following error.
!!! error TS2769: Overload 2 of 2, '(entries?: readonly (readonly [object, boolean])[]): WeakMap<object, boolean>', gave the following error.
!!! error TS2769: Type 'symbol' is not assignable to type 'object'.
wm.set(s, true);
~
Expand Down