Skip to content

Commit 5bfb957

Browse files
committed
Fix collection of-from proposal types
1 parent 35aafe9 commit 5bfb957

File tree

2 files changed

+8
-8
lines changed

2 files changed

+8
-8
lines changed

packages/core-js-types/src/base/proposals/collection-of-from.d.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -52,15 +52,15 @@ interface WeakMapConstructor {
5252
* @param thisArg - Value to use as this when executing mapFn.
5353
* @returns A new `WeakMap` instance.
5454
*/
55-
from<K extends object, V, KOut extends object = K, VOut = V>(source: Iterable<[K, V]>, mapFn?: (entry: [K, V], index: number) => [KOut, VOut], thisArg?: any): WeakMap<KOut, VOut>;
55+
from<K extends WeakKey, V, KOut extends WeakKey = K, VOut = V>(source: Iterable<[K, V]>, mapFn?: (entry: [K, V], index: number) => [KOut, VOut], thisArg?: any): WeakMap<KOut, VOut>;
5656

5757
/**
5858
* Creates a new `WeakMap` instance from a variable number of arguments,
5959
* where each pair of arguments is interpreted as a key and a value.
6060
* @param items - An even number of arguments representing key-value pairs.
6161
* @returns A new `WeakMap` instance.
6262
*/
63-
of<K extends object, V>(...items: [K, V][]): WeakMap<K, V>;
63+
of<K extends WeakKey, V>(...items: [K, V][]): WeakMap<K, V>;
6464
}
6565

6666
declare var WeakMap: WeakMapConstructor;
@@ -73,14 +73,14 @@ interface WeakSetConstructor {
7373
* @param thisArg - Value to use as `this` in `mapFn`.
7474
* @returns New `WeakSet` instance.
7575
*/
76-
from<T extends object, U extends object = T>(source: Iterable<T>, mapFn?: (value: T, index: number) => U, thisArg?: any): WeakSet<U>;
76+
from<T extends WeakKey, U extends WeakKey = T>(source: Iterable<T>, mapFn?: (value: T, index: number) => U, thisArg?: any): WeakSet<U>;
7777

7878
/**
7979
* Creates a new `WeakSet` instance from object arguments.
8080
* @param items - Zero or more objects to add as WeakSet elements.
8181
* @returns New `WeakSet` instance.
8282
*/
83-
of<T extends object>(...items: T[]): WeakSet<T>;
83+
of<T extends WeakKey>(...items: T[]): WeakSet<T>;
8484
}
8585

8686
declare var WeakSet: WeakSetConstructor;

packages/core-js-types/src/base/pure/proposals/collection-of-from.d.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -60,15 +60,15 @@ declare namespace CoreJS {
6060
* @param thisArg - Value to use as this when executing mapFn.
6161
* @returns A new `WeakMap` instance.
6262
*/
63-
from<K extends object, V, KOut extends object = K, VOut = V>(source: Iterable<[K, V]>, mapFn?: (entry: [K, V], index: number) => [KOut, VOut], thisArg?: any): CoreJS.CoreJSWeakMap<KOut, VOut>;
63+
from<K extends WeakKey, V, KOut extends WeakKey = K, VOut = V>(source: Iterable<[K, V]>, mapFn?: (entry: [K, V], index: number) => [KOut, VOut], thisArg?: any): CoreJS.CoreJSWeakMap<KOut, VOut>;
6464

6565
/**
6666
* Creates a new `WeakMap` instance from a variable number of arguments,
6767
* where each pair of arguments is interpreted as a key and a value.
6868
* @param items - An even number of arguments representing key-value pairs.
6969
* @returns A new `WeakMap` instance.
7070
*/
71-
of<K extends object, V>(...items: [K, V][]): CoreJS.CoreJSWeakMap<K, V>;
71+
of<K extends WeakKey, V>(...items: [K, V][]): CoreJS.CoreJSWeakMap<K, V>;
7272
}
7373

7474
var CoreJSWeakMap: CoreJSWeakMapConstructor;
@@ -81,14 +81,14 @@ declare namespace CoreJS {
8181
* @param thisArg - Value to use as `this` in `mapFn`.
8282
* @returns New `WeakSet` instance.
8383
*/
84-
from<T extends object, U extends object = T>(source: Iterable<T>, mapFn?: (value: T, index: number) => U, thisArg?: any): CoreJS.CoreJSWeakSet<U>;
84+
from<T extends WeakKey, U extends WeakKey = T>(source: Iterable<T>, mapFn?: (value: T, index: number) => U, thisArg?: any): CoreJS.CoreJSWeakSet<U>;
8585

8686
/**
8787
* Creates a new `WeakSet` instance from object arguments.
8888
* @param items - Zero or more objects to add as WeakSet elements.
8989
* @returns New `WeakSet` instance.
9090
*/
91-
of<T extends object>(...items: T[]): CoreJS.CoreJSWeakSet<T>;
91+
of<T extends WeakKey>(...items: T[]): CoreJS.CoreJSWeakSet<T>;
9292
}
9393

9494
var CoreJSWeakSet: CoreJSWeakSetConstructor;

0 commit comments

Comments
 (0)