10000 Fix ts definitions for merge functions (#1336) · lisongyu/immutable-js@3109aff · GitHub
[go: up one dir, main page]

Skip to content

Commit 3109aff

Browse files
authored
Fix ts definitions for merge functions (immutable-js#1336)
Merge functions accept any iterable, not just collections. Closes immutable-js#1303
1 parent ff8094f commit 3109aff

File tree

1 file changed

+10
-10
lines changed

1 file changed

+10
-10
lines changed

type-definitions/Immutable.d.ts

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -680,7 +680,7 @@ declare module Immutable {
680680
*
681681
* @see `Map#merge`
682682
*/
683-
merge(...collections: Array<Collection.Indexed<T> | Array<T>>): this;
683+
merge(...collections: Array<Iterable<T>>): this;
684684

685685
/**
686686
* Note: `mergeWith` can be used in `withMutations`.
@@ -689,23 +689,23 @@ declare module Immutable {
689689
*/
690690
mergeWith(
691691
merger: (oldVal: T, newVal: T, key: number) => T,
692-
...collections: Array<Collection.Indexed<T> | Array<T>>
692+
...collections: Array<Iterable<T>>
693693
): this;
694694

695695
/**
696696
* Note: `mergeDeep` can be used in `withMutations`.
697697
*
698698
* @see `Map#mergeDeep`
699699
*/
700-
mergeDeep(...collections: Array<Collection.Indexed<T> | Array<T>>): this;
700+
mergeDeep(...collections: Array<Iterable<T>>): this;
701701

702702
/**
703703
* Note: `mergeDeepWith` can be used in `withMutations`.
704704
* @see `Map#mergeDeepWith`
705705
*/
706706
mergeDeepWith(
707707
merger: (oldVal: T, newVal: T, key: number) => T,
708-
...collections: Array<Collection.Indexed<T> | Array<T>>
708+
...collections: Array<Iterable<T>>
709709
): this;
710710

711711
/**
@@ -1251,7 +1251,7 @@ declare module Immutable {
12511251
*
12521252
* Note: `merge` can be used in `withMutations`.
12531253
*/
1254-
merge(...collections: Array<Collection<K, V> | {[key: string]: V}>): this;
1254+
merge(...collections: Array<Iterable<[K, V]> | {[key: string]: V}>): this;
12551255

12561256
/**
12571257
* Like `merge()`, `mergeWith()` returns a new Map resulting from merging
@@ -1273,7 +1273,7 @@ declare module Immutable {
12731273
*/
12741274
mergeWith(
12751275
merger: (oldVal: V, newVal: V, key: K) => V,
1276-
...collections: Array<Collection<K, V> | {[key: string]: V}>
1276+
...collections: Array<Iterable<[K, V]> | {[key: string]: V}>
12771277
): this;
12781278

12791279
/**
@@ -1295,7 +1295,7 @@ declare module Immutable {
12951295
*
12961296
* Note: `mergeDeep` can be used in `withMutations`.
12971297
*/
1298-
mergeDeep(...collections: Array<Collection<K, V> | {[key: string]: V}>): this;
1298+
mergeDeep(...collections: Array<Iterable<[K, V]> | {[key: string]: V}>): this;
12991299

13001300
/**
13011301
* Like `mergeDeep()`, but when two non-Collections conflict, it uses the
@@ -1318,7 +1318,7 @@ declare module Immutable {
13181318
*/
13191319
mergeDeepWith(
13201320
merger: (oldVal: V, newVal: V, key: K) => V,
1321-
...collections: Array<Collection<K, V> | {[key: string]: V}>
1321+
...collections: Array<Iterable<[K, V]> | {[key: string]: V}>
13221322
): this;
13231323

13241324

@@ -1835,8 +1835,8 @@ declare module Immutable {
18351835
* Note: `union` can be used in `withMutations`.
18361836
* @alias merge
18371837
*/
1838-
union(...collections: Array<Collection<any, T> | Array<T>>): this;
1839-
merge(...collections: Array<Collection<any, T> | Array<T>>): this;
1838+
union(...collections: Array<Iterable<T>>): this;
1839+
merge(...collections: Array<Iterable<T>>): this;
18401840

18411841
/**
18421842
* Returns a Set which has removed any values not also contained

0 commit comments

Comments
 (0)
0