immutable 4.0.0-rc.10 → 4.0.0-rc.15
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.
- package/LICENSE +1 -1
- package/README.md +174 -100
- package/dist/immutable.d.ts +824 -528
- package/dist/immutable.es.js +626 -509
- package/dist/immutable.js +657 -531
- package/dist/immutable.js.flow +937 -264
- package/dist/immutable.min.js +53 -36
- package/package.json +7 -11
- package/contrib/cursor/README.md +0 -43
- package/contrib/cursor/__tests__/Cursor.ts.skip +0 -395
- package/contrib/cursor/index.d.ts +0 -287
- package/contrib/cursor/index.js +0 -360
- package/dist/immutable-nonambient.d.ts +0 -5333
package/dist/immutable.d.ts
CHANGED
|
@@ -1,10 +1,3 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Copyright (c) 2014-present, Facebook, Inc.
|
|
3
|
-
*
|
|
4
|
-
* This source code is licensed under the MIT license found in the
|
|
5
|
-
* LICENSE file in the root directory of this source tree.
|
|
6
|
-
*/
|
|
7
|
-
|
|
8
1
|
/**
|
|
9
2
|
* Immutable data encourages pure functions (data-in, data-out) and lends itself
|
|
10
3
|
* to much simpler application development and enabling techniques from
|
|
@@ -73,7 +66,7 @@
|
|
|
73
66
|
* `getIn` which expects an `Iterable` path:
|
|
74
67
|
*
|
|
75
68
|
* ```
|
|
76
|
-
* getIn(path: Iterable<string | number>):
|
|
69
|
+
* getIn(path: Iterable<string | number>): unknown
|
|
77
70
|
* ```
|
|
78
71
|
*
|
|
79
72
|
* To use this method, we could pass an array: `data.getIn([ "key", 2 ])`.
|
|
@@ -92,13 +85,12 @@
|
|
|
92
85
|
* ```
|
|
93
86
|
*
|
|
94
87
|
* [ES2015]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/New_in_JavaScript/ECMAScript_6_support_in_Mozilla
|
|
95
|
-
* [TypeScript]:
|
|
88
|
+
* [TypeScript]: https://www.typescriptlang.org/
|
|
96
89
|
* [Flow]: https://flowtype.org/
|
|
97
90
|
* [Iterable]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols
|
|
98
91
|
*/
|
|
99
92
|
|
|
100
|
-
declare
|
|
101
|
-
|
|
93
|
+
declare namespace Immutable {
|
|
102
94
|
/**
|
|
103
95
|
* Lists are ordered indexed dense collections, much like a JavaScript
|
|
104
96
|
* Array.
|
|
@@ -113,8 +105,7 @@ declare module Immutable {
|
|
|
113
105
|
* "unset" index and an index set to `undefined`. `List#forEach` visits all
|
|
114
106
|
* indices from 0 to size, regardless of whether they were explicitly defined.
|
|
115
107
|
*/
|
|
116
|
-
|
|
117
|
-
|
|
108
|
+
namespace List {
|
|
118
109
|
/**
|
|
119
110
|
* True if the provided value is a List
|
|
120
111
|
*
|
|
@@ -125,7 +116,7 @@ declare module Immutable {
|
|
|
125
116
|
* List.isList(List()); // true
|
|
126
117
|
* ```
|
|
127
118
|
*/
|
|
128
|
-
function isList(maybeList:
|
|
119
|
+
function isList(maybeList: unknown): maybeList is List<unknown>;
|
|
129
120
|
|
|
130
121
|
/**
|
|
131
122
|
* Creates a new List containing `values`.
|
|
@@ -180,12 +171,9 @@ declare module Immutable {
|
|
|
180
171
|
* listFromPlainSet.equals(listFromPlainArray) // true
|
|
181
172
|
* ```
|
|
182
173
|
*/
|
|
183
|
-
|
|
184
|
-
export function List<T>(): List<T>;
|
|
185
|
-
export function List<T>(collection: Iterable<T>): List<T>;
|
|
186
|
-
|
|
187
|
-
export interface List<T> extends Collection.Indexed<T> {
|
|
174
|
+
function List<T>(collection?: Iterable<T> | ArrayLike<T>): List<T>;
|
|
188
175
|
|
|
176
|
+
interface List<T> extends Collection.Indexed<T> {
|
|
189
177
|
/**
|
|
190
178
|
* The number of items in this List.
|
|
191
179
|
*/
|
|
@@ -402,7 +390,7 @@ declare module Immutable {
|
|
|
402
390
|
* @see `Map#update`
|
|
403
391
|
*/
|
|
404
392
|
update(index: number, notSetValue: T, updater: (value: T) => T): this;
|
|
405
|
-
update(index: number, updater: (value: T) => T): this;
|
|
393
|
+
update(index: number, updater: (value: T | undefined) => T): this;
|
|
406
394
|
update<R>(updater: (value: this) => R): R;
|
|
407
395
|
|
|
408
396
|
/**
|
|
@@ -417,7 +405,6 @@ declare module Immutable {
|
|
|
417
405
|
*/
|
|
418
406
|
setSize(size: number): List<T>;
|
|
419
407
|
|
|
420
|
-
|
|
421
408
|
// Deep persistent changes
|
|
422
409
|
|
|
423
410
|
/**
|
|
@@ -449,7 +436,7 @@ declare module Immutable {
|
|
|
449
436
|
*
|
|
450
437
|
* Note: `setIn` can be used in `withMutations`.
|
|
451
438
|
*/
|
|
452
|
-
setIn(keyPath: Iterable<
|
|
439
|
+
setIn(keyPath: Iterable<unknown>, value: unknown): this;
|
|
453
440
|
|
|
454
441
|
/**
|
|
455
442
|
* Returns a new List having removed the value at this `keyPath`. If any
|
|
@@ -479,30 +466,40 @@ declare module Immutable {
|
|
|
479
466
|
*
|
|
480
467
|
* @alias removeIn
|
|
481
468
|
*/
|
|
482
|
-
deleteIn(keyPath: Iterable<
|
|
483
|
-
removeIn(keyPath: Iterable<
|
|
469
|
+
deleteIn(keyPath: Iterable<unknown>): this;
|
|
470
|
+
removeIn(keyPath: Iterable<unknown>): this;
|
|
484
471
|
|
|
485
472
|
/**
|
|
486
473
|
* Note: `updateIn` can be used in `withMutations`.
|
|
487
474
|
*
|
|
488
475
|
* @see `Map#updateIn`
|
|
489
476
|
*/
|
|
490
|
-
updateIn(
|
|
491
|
-
|
|
477
|
+
updateIn(
|
|
478
|
+
keyPath: Iterable<unknown>,
|
|
479
|
+
notSetValue: unknown,
|
|
480
|
+
updater: (value: unknown) => unknown
|
|
481
|
+
): this;
|
|
482
|
+
updateIn(
|
|
483
|
+
keyPath: Iterable<unknown>,
|
|
484
|
+
updater: (value: unknown) => unknown
|
|
485
|
+
): this;
|
|
492
486
|
|
|
493
487
|
/**
|
|
494
488
|
* Note: `mergeIn` can be used in `withMutations`.
|
|
495
489
|
*
|
|
496
490
|
* @see `Map#mergeIn`
|
|
497
491
|
*/
|
|
498
|
-
mergeIn(keyPath: Iterable<
|
|
492
|
+
mergeIn(keyPath: Iterable<unknown>, ...collections: Array<unknown>): this;
|
|
499
493
|
|
|
500
494
|
/**
|
|
501
495
|
* Note: `mergeDeepIn` can be used in `withMutations`.
|
|
502
496
|
*
|
|
503
497
|
* @see `Map#mergeDeepIn`
|
|
504
498
|
*/
|
|
505
|
-
mergeDeepIn(
|
|
499
|
+
mergeDeepIn(
|
|
500
|
+
keyPath: Iterable<unknown>,
|
|
501
|
+
...collections: Array<unknown>
|
|
502
|
+
): this;
|
|
506
503
|
|
|
507
504
|
// Transient changes
|
|
508
505
|
|
|
@@ -513,7 +510,7 @@ declare module Immutable {
|
|
|
513
510
|
*
|
|
514
511
|
* @see `Map#withMutations`
|
|
515
512
|
*/
|
|
516
|
-
withMutations(mutator: (mutable: this) =>
|
|
513
|
+
withMutations(mutator: (mutable: this) => unknown): this;
|
|
517
514
|
|
|
518
515
|
/**
|
|
519
516
|
* An alternative API for withMutations()
|
|
@@ -562,7 +559,7 @@ declare module Immutable {
|
|
|
562
559
|
*/
|
|
563
560
|
map<M>(
|
|
564
561
|
mapper: (value: T, key: number, iter: this) => M,
|
|
565
|
-
context?:
|
|
562
|
+
context?: unknown
|
|
566
563
|
): List<M>;
|
|
567
564
|
|
|
568
565
|
/**
|
|
@@ -572,7 +569,7 @@ declare module Immutable {
|
|
|
572
569
|
*/
|
|
573
570
|
flatMap<M>(
|
|
574
571
|
mapper: (value: T, key: number, iter: this) => Iterable<M>,
|
|
575
|
-
context?:
|
|
572
|
+
context?: unknown
|
|
576
573
|
): List<M>;
|
|
577
574
|
|
|
578
575
|
/**
|
|
@@ -584,11 +581,11 @@ declare module Immutable {
|
|
|
584
581
|
*/
|
|
585
582
|
filter<F extends T>(
|
|
586
583
|
predicate: (value: T, index: number, iter: this) => value is F,
|
|
587
|
-
context?:
|
|
584
|
+
context?: unknown
|
|
588
585
|
): List<F>;
|
|
589
586
|
filter(
|
|
590
|
-
predicate: (value: T, index: number, iter: this) =>
|
|
591
|
-
context?:
|
|
587
|
+
predicate: (value: T, index: number, iter: this) => unknown,
|
|
588
|
+
context?: unknown
|
|
592
589
|
): this;
|
|
593
590
|
|
|
594
591
|
/**
|
|
@@ -605,9 +602,12 @@ declare module Immutable {
|
|
|
605
602
|
* const c = a.zip(b); // List [ [ 1, 4 ], [ 2, 5 ], [ 3, 6 ] ]
|
|
606
603
|
* ```
|
|
607
604
|
*/
|
|
608
|
-
zip<U>(other: Collection<
|
|
609
|
-
zip<U,V>(
|
|
610
|
-
|
|
605
|
+
zip<U>(other: Collection<unknown, U>): List<[T, U]>;
|
|
606
|
+
zip<U, V>(
|
|
607
|
+
other: Collection<unknown, U>,
|
|
608
|
+
other2: Collection<unknown, V>
|
|
609
|
+
): List<[T, U, V]>;
|
|
610
|
+
zip(...collections: Array<Collection<unknown, unknown>>): List<unknown>;
|
|
611
611
|
|
|
612
612
|
/**
|
|
613
613
|
* Returns a List "zipped" with the provided collections.
|
|
@@ -628,9 +628,12 @@ declare module Immutable {
|
|
|
628
628
|
* input, some results may contain undefined values. TypeScript cannot
|
|
629
629
|
* account for these without cases (as of v2.5).
|
|
630
630
|
*/
|
|
631
|
-
zipAll<U>(other: Collection<
|
|
632
|
-
zipAll<U,V>(
|
|
633
|
-
|
|
631
|
+
zipAll<U>(other: Collection<unknown, U>): List<[T, U]>;
|
|
632
|
+
zipAll<U, V>(
|
|
633
|
+
other: Collection<unknown, U>,
|
|
634
|
+
other2: Collection<unknown, V>
|
|
635
|
+
): List<[T, U, V]>;
|
|
636
|
+
zipAll(...collections: Array<Collection<unknown, unknown>>): List<unknown>;
|
|
634
637
|
|
|
635
638
|
/**
|
|
636
639
|
* Returns a List "zipped" with the provided collections by using a
|
|
@@ -648,20 +651,19 @@ declare module Immutable {
|
|
|
648
651
|
*/
|
|
649
652
|
zipWith<U, Z>(
|
|
650
653
|
zipper: (value: T, otherValue: U) => Z,
|
|
651
|
-
otherCollection: Collection<
|
|
654
|
+
otherCollection: Collection<unknown, U>
|
|
652
655
|
): List<Z>;
|
|
653
656
|
zipWith<U, V, Z>(
|
|
654
657
|
zipper: (value: T, otherValue: U, thirdValue: V) => Z,
|
|
655
|
-
otherCollection: Collection<
|
|
656
|
-
thirdCollection: Collection<
|
|
658
|
+
otherCollection: Collection<unknown, U>,
|
|
659
|
+
thirdCollection: Collection<unknown, V>
|
|
657
660
|
): List<Z>;
|
|
658
661
|
zipWith<Z>(
|
|
659
|
-
zipper: (...
|
|
660
|
-
...collections: Array<Collection<
|
|
662
|
+
zipper: (...values: Array<unknown>) => Z,
|
|
663
|
+
...collections: Array<Collection<unknown, unknown>>
|
|
661
664
|
): List<Z>;
|
|
662
665
|
}
|
|
663
666
|
|
|
664
|
-
|
|
665
667
|
/**
|
|
666
668
|
* Immutable Map is an unordered Collection.Keyed of (key, value) pairs with
|
|
667
669
|
* `O(log32 N)` gets and `O(log32 N)` persistent sets.
|
|
@@ -689,8 +691,7 @@ declare module Immutable {
|
|
|
689
691
|
*
|
|
690
692
|
* Implemented by a hash-array mapped trie.
|
|
691
693
|
*/
|
|
692
|
-
|
|
693
|
-
|
|
694
|
+
namespace Map {
|
|
694
695
|
/**
|
|
695
696
|
* True if the provided value is a Map
|
|
696
697
|
*
|
|
@@ -701,7 +702,7 @@ declare module Immutable {
|
|
|
701
702
|
* Map.isMap(Map()) // true
|
|
702
703
|
* ```
|
|
703
704
|
*/
|
|
704
|
-
function isMap(maybeMap:
|
|
705
|
+
function isMap(maybeMap: unknown): maybeMap is Map<unknown, unknown>;
|
|
705
706
|
|
|
706
707
|
/**
|
|
707
708
|
* Creates a new Map from alternating keys and values
|
|
@@ -719,7 +720,7 @@ declare module Immutable {
|
|
|
719
720
|
*
|
|
720
721
|
* @deprecated Use Map([ [ 'k', 'v' ] ]) or Map({ k: 'v' })
|
|
721
722
|
*/
|
|
722
|
-
function of(...keyValues: Array<
|
|
723
|
+
function of(...keyValues: Array<unknown>): Map<unknown, unknown>;
|
|
723
724
|
}
|
|
724
725
|
|
|
725
726
|
/**
|
|
@@ -758,14 +759,11 @@ declare module Immutable {
|
|
|
758
759
|
* but since Immutable Map keys can be of any type the argument to `get()` is
|
|
759
760
|
* not altered.
|
|
760
761
|
*/
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
export function Map<K, V>(): Map<K, V>;
|
|
765
|
-
export function Map(): Map<any, any>;
|
|
766
|
-
|
|
767
|
-
export interface Map<K, V> extends Collection.Keyed<K, V> {
|
|
762
|
+
function Map<K, V>(collection?: Iterable<[K, V]>): Map<K, V>;
|
|
763
|
+
function Map<V>(obj: { [key: string]: V }): Map<string, V>;
|
|
764
|
+
function Map<K extends string, V>(obj: { [P in K]?: V }): Map<K, V>;
|
|
768
765
|
|
|
766
|
+
interface Map<K, V> extends Collection.Keyed<K, V> {
|
|
769
767
|
/**
|
|
770
768
|
* The number of entries in this Map.
|
|
771
769
|
*/
|
|
@@ -956,7 +954,7 @@ declare module Immutable {
|
|
|
956
954
|
* Note: `update(key)` can be used in `withMutations`.
|
|
957
955
|
*/
|
|
958
956
|
update(key: K, notSetValue: V, updater: (value: V) => V): this;
|
|
959
|
-
update(key: K, updater: (value: V) => V): this;
|
|
957
|
+
update(key: K, updater: (value: V | undefined) => V): this;
|
|
960
958
|
update<R>(updater: (value: this) => R): R;
|
|
961
959
|
|
|
962
960
|
/**
|
|
@@ -980,10 +978,18 @@ declare module Immutable {
|
|
|
980
978
|
*
|
|
981
979
|
* @alias concat
|
|
982
980
|
*/
|
|
983
|
-
merge<KC, VC>(
|
|
984
|
-
|
|
985
|
-
|
|
986
|
-
|
|
981
|
+
merge<KC, VC>(
|
|
982
|
+
...collections: Array<Iterable<[KC, VC]>>
|
|
983
|
+
): Map<K | KC, V | VC>;
|
|
984
|
+
merge<C>(
|
|
985
|
+
...collections: Array<{ [key: string]: C }>
|
|
986
|
+
): Map<K | string, V | C>;
|
|
987
|
+
concat<KC, VC>(
|
|
988
|
+
...collections: Array<Iterable<[KC, VC]>>
|
|
989
|
+
): Map<K | KC, V | VC>;
|
|
990
|
+
concat<C>(
|
|
991
|
+
...collections: Array<{ [key: string]: C }>
|
|
992
|
+
): Map<K | string, V | C>;
|
|
987
993
|
|
|
988
994
|
/**
|
|
989
995
|
* Like `merge()`, `mergeWith()` returns a new Map resulting from merging
|
|
@@ -1005,16 +1011,22 @@ declare module Immutable {
|
|
|
1005
1011
|
*/
|
|
1006
1012
|
mergeWith(
|
|
1007
1013
|
merger: (oldVal: V, newVal: V, key: K) => V,
|
|
1008
|
-
...collections: Array<Iterable<[K, V]> | {[key: string]: V}>
|
|
1014
|
+
...collections: Array<Iterable<[K, V]> | { [key: string]: V }>
|
|
1009
1015
|
): this;
|
|
1010
1016
|
|
|
1011
1017
|
/**
|
|
1012
|
-
* Like `merge()`, but when two
|
|
1013
|
-
* recursing deeply through the nested
|
|
1018
|
+
* Like `merge()`, but when two compatible collections are encountered with
|
|
1019
|
+
* the same key, it merges them as well, recursing deeply through the nested
|
|
1020
|
+
* data. Two collections are considered to be compatible (and thus will be
|
|
1021
|
+
* merged together) if they both fall into one of three categories: keyed
|
|
1022
|
+
* (e.g., `Map`s, `Record`s, and objects), indexed (e.g., `List`s and
|
|
1023
|
+
* arrays), or set-like (e.g., `Set`s). If they fall into separate
|
|
1024
|
+
* categories, `mergeDeep` will replace the existing collection with the
|
|
1025
|
+
* collection being merged in. This behavior can be customized by using
|
|
1026
|
+
* `mergeDeepWith()`.
|
|
1014
1027
|
*
|
|
1015
|
-
* Note:
|
|
1016
|
-
*
|
|
1017
|
-
* a deeper level.
|
|
1028
|
+
* Note: Indexed and set-like collections are merged using
|
|
1029
|
+
* `concat()`/`union()` and therefore do not recurse.
|
|
1018
1030
|
*
|
|
1019
1031
|
* <!-- runkit:activate -->
|
|
1020
1032
|
* ```js
|
|
@@ -1031,11 +1043,16 @@ declare module Immutable {
|
|
|
1031
1043
|
*
|
|
1032
1044
|
* Note: `mergeDeep` can be used in `withMutations`.
|
|
1033
1045
|
*/
|
|
1034
|
-
mergeDeep(
|
|
1046
|
+
mergeDeep(
|
|
1047
|
+
...collections: Array<Iterable<[K, V]> | { [key: string]: V }>
|
|
1048
|
+
): this;
|
|
1035
1049
|
|
|
1036
1050
|
/**
|
|
1037
|
-
* Like `mergeDeep()`, but when two non-
|
|
1038
|
-
*
|
|
1051
|
+
* Like `mergeDeep()`, but when two non-collections or incompatible
|
|
1052
|
+
* collections are encountered at the same key, it uses the `merger`
|
|
1053
|
+
* function to determine the resulting value. Collections are considered
|
|
1054
|
+
* incompatible if they fall into separate categories between keyed,
|
|
1055
|
+
* indexed, and set-like.
|
|
1039
1056
|
*
|
|
1040
1057
|
* <!-- runkit:activate -->
|
|
1041
1058
|
* ```js
|
|
@@ -1049,15 +1066,14 @@ declare module Immutable {
|
|
|
1049
1066
|
* // "c": Map { "z": 3 }
|
|
1050
1067
|
* // }
|
|
1051
1068
|
* ```
|
|
1052
|
-
|
|
1069
|
+
*
|
|
1053
1070
|
* Note: `mergeDeepWith` can be used in `withMutations`.
|
|
1054
1071
|
*/
|
|
1055
1072
|
mergeDeepWith(
|
|
1056
|
-
merger: (oldVal:
|
|
1057
|
-
...collections: Array<Iterable<[K, V]> | {[key: string]: V}>
|
|
1073
|
+
merger: (oldVal: unknown, newVal: unknown, key: unknown) => unknown,
|
|
1074
|
+
...collections: Array<Iterable<[K, V]> | { [key: string]: V }>
|
|
1058
1075
|
): this;
|
|
1059
1076
|
|
|
1060
|
-
|
|
1061
1077
|
// Deep persistent changes
|
|
1062
1078
|
|
|
1063
1079
|
/**
|
|
@@ -1126,7 +1142,7 @@ declare module Immutable {
|
|
|
1126
1142
|
*
|
|
1127
1143
|
* Note: `setIn` can be used in `withMutations`.
|
|
1128
1144
|
*/
|
|
1129
|
-
setIn(keyPath: Iterable<
|
|
1145
|
+
setIn(keyPath: Iterable<unknown>, value: unknown): this;
|
|
1130
1146
|
|
|
1131
1147
|
/**
|
|
1132
1148
|
* Returns a new Map having removed the value at this `keyPath`. If any keys
|
|
@@ -1136,8 +1152,8 @@ declare module Immutable {
|
|
|
1136
1152
|
*
|
|
1137
1153
|
* @alias removeIn
|
|
1138
1154
|
*/
|
|
1139
|
-
deleteIn(keyPath: Iterable<
|
|
1140
|
-
removeIn(keyPath: Iterable<
|
|
1155
|
+
deleteIn(keyPath: Iterable<unknown>): this;
|
|
1156
|
+
removeIn(keyPath: Iterable<unknown>): this;
|
|
1141
1157
|
|
|
1142
1158
|
/**
|
|
1143
1159
|
* Returns a new Map having applied the `updater` to the entry found at the
|
|
@@ -1215,8 +1231,15 @@ declare module Immutable {
|
|
|
1215
1231
|
*
|
|
1216
1232
|
* Note: `updateIn` can be used in `withMutations`.
|
|
1217
1233
|
*/
|
|
1218
|
-
updateIn(
|
|
1219
|
-
|
|
1234
|
+
updateIn(
|
|
1235
|
+
keyPath: Iterable<unknown>,
|
|
1236
|
+
notSetValue: unknown,
|
|
1237
|
+
updater: (value: unknown) => unknown
|
|
1238
|
+
): this;
|
|
1239
|
+
updateIn(
|
|
1240
|
+
keyPath: Iterable<unknown>,
|
|
1241
|
+
updater: (value: unknown) => unknown
|
|
1242
|
+
): this;
|
|
1220
1243
|
|
|
1221
1244
|
/**
|
|
1222
1245
|
* A combination of `updateIn` and `merge`, returning a new Map, but
|
|
@@ -1230,7 +1253,7 @@ declare module Immutable {
|
|
|
1230
1253
|
*
|
|
1231
1254
|
* Note: `mergeIn` can be used in `withMutations`.
|
|
1232
1255
|
*/
|
|
1233
|
-
mergeIn(keyPath: Iterable<
|
|
1256
|
+
mergeIn(keyPath: Iterable<unknown>, ...collections: Array<unknown>): this;
|
|
1234
1257
|
|
|
1235
1258
|
/**
|
|
1236
1259
|
* A combination of `updateIn` and `mergeDeep`, returning a new Map, but
|
|
@@ -1244,7 +1267,10 @@ declare module Immutable {
|
|
|
1244
1267
|
*
|
|
1245
1268
|
* Note: `mergeDeepIn` can be used in `withMutations`.
|
|
1246
1269
|
*/
|
|
1247
|
-
mergeDeepIn(
|
|
1270
|
+
mergeDeepIn(
|
|
1271
|
+
keyPath: Iterable<unknown>,
|
|
1272
|
+
...collections: Array<unknown>
|
|
1273
|
+
): this;
|
|
1248
1274
|
|
|
1249
1275
|
// Transient changes
|
|
1250
1276
|
|
|
@@ -1276,7 +1302,7 @@ declare module Immutable {
|
|
|
1276
1302
|
* `withMutations`! Read the documentation for each method to see if it
|
|
1277
1303
|
* is safe to use in `withMutations`.
|
|
1278
1304
|
*/
|
|
1279
|
-
withMutations(mutator: (mutable: this) =>
|
|
1305
|
+
withMutations(mutator: (mutable: this) => unknown): this;
|
|
1280
1306
|
|
|
1281
1307
|
/**
|
|
1282
1308
|
* Another way to avoid creation of intermediate Immutable maps is to create
|
|
@@ -1331,7 +1357,7 @@ declare module Immutable {
|
|
|
1331
1357
|
*/
|
|
1332
1358
|
map<M>(
|
|
1333
1359
|
mapper: (value: V, key: K, iter: this) => M,
|
|
1334
|
-
context?:
|
|
1360
|
+
context?: unknown
|
|
1335
1361
|
): Map<K, M>;
|
|
1336
1362
|
|
|
1337
1363
|
/**
|
|
@@ -1339,15 +1365,19 @@ declare module Immutable {
|
|
|
1339
1365
|
*/
|
|
1340
1366
|
mapKeys<M>(
|
|
1341
1367
|
mapper: (key: K, value: V, iter: this) => M,
|
|
1342
|
-
context?:
|
|
1368
|
+
context?: unknown
|
|
1343
1369
|
): Map<M, V>;
|
|
1344
1370
|
|
|
1345
1371
|
/**
|
|
1346
1372
|
* @see Collection.Keyed.mapEntries
|
|
1347
1373
|
*/
|
|
1348
1374
|
mapEntries<KM, VM>(
|
|
1349
|
-
mapper: (
|
|
1350
|
-
|
|
1375
|
+
mapper: (
|
|
1376
|
+
entry: [K, V],
|
|
1377
|
+
index: number,
|
|
1378
|
+
iter: this
|
|
1379
|
+
) => [KM, VM] | undefined,
|
|
1380
|
+
context?: unknown
|
|
1351
1381
|
): Map<KM, VM>;
|
|
1352
1382
|
|
|
1353
1383
|
/**
|
|
@@ -1357,7 +1387,7 @@ declare module Immutable {
|
|
|
1357
1387
|
*/
|
|
1358
1388
|
flatMap<KM, VM>(
|
|
1359
1389
|
mapper: (value: V, key: K, iter: this) => Iterable<[KM, VM]>,
|
|
1360
|
-
context?:
|
|
1390
|
+
context?: unknown
|
|
1361
1391
|
): Map<KM, VM>;
|
|
1362
1392
|
|
|
1363
1393
|
/**
|
|
@@ -1369,11 +1399,11 @@ declare module Immutable {
|
|
|
1369
1399
|
*/
|
|
1370
1400
|
filter<F extends V>(
|
|
1371
1401
|
predicate: (value: V, key: K, iter: this) => value is F,
|
|
1372
|
-
context?:
|
|
1402
|
+
context?: unknown
|
|
1373
1403
|
): Map<K, F>;
|
|
1374
1404
|
filter(
|
|
1375
|
-
predicate: (value: V, key: K, iter: this) =>
|
|
1376
|
-
context?:
|
|
1405
|
+
predicate: (value: V, key: K, iter: this) => unknown,
|
|
1406
|
+
context?: unknown
|
|
1377
1407
|
): this;
|
|
1378
1408
|
|
|
1379
1409
|
/**
|
|
@@ -1382,7 +1412,6 @@ declare module Immutable {
|
|
|
1382
1412
|
flip(): Map<V, K>;
|
|
1383
1413
|
}
|
|
1384
1414
|
|
|
1385
|
-
|
|
1386
1415
|
/**
|
|
1387
1416
|
* A type of Map that has the additional guarantee that the iteration order of
|
|
1388
1417
|
* entries will be the order in which they were set().
|
|
@@ -1394,13 +1423,13 @@ declare module Immutable {
|
|
|
1394
1423
|
* consume more memory. `OrderedMap#set` is amortized O(log32 N), but not
|
|
1395
1424
|
* stable.
|
|
1396
1425
|
*/
|
|
1397
|
-
|
|
1398
|
-
export module OrderedMap {
|
|
1399
|
-
|
|
1426
|
+
namespace OrderedMap {
|
|
1400
1427
|
/**
|
|
1401
1428
|
* True if the provided value is an OrderedMap.
|
|
1402
1429
|
*/
|
|
1403
|
-
function isOrderedMap(
|
|
1430
|
+
function isOrderedMap(
|
|
1431
|
+
maybeOrderedMap: unknown
|
|
1432
|
+
): maybeOrderedMap is OrderedMap<unknown, unknown>;
|
|
1404
1433
|
}
|
|
1405
1434
|
|
|
1406
1435
|
/**
|
|
@@ -1418,14 +1447,10 @@ declare module Immutable {
|
|
|
1418
1447
|
* Note: `OrderedMap` is a factory function and not a class, and does not use
|
|
1419
1448
|
* the `new` keyword during construction.
|
|
1420
1449
|
*/
|
|
1421
|
-
|
|
1422
|
-
|
|
1423
|
-
export function OrderedMap<V>(obj: {[key: string]: V}): OrderedMap<string, V>;
|
|
1424
|
-
export function OrderedMap<K, V>(): OrderedMap<K, V>;
|
|
1425
|
-
export function OrderedMap(): OrderedMap<any, any>;
|
|
1426
|
-
|
|
1427
|
-
export interface OrderedMap<K, V> extends Map<K, V> {
|
|
1450
|
+
function OrderedMap<K, V>(collection?: Iterable<[K, V]>): OrderedMap<K, V>;
|
|
1451
|
+
function OrderedMap<V>(obj: { [key: string]: V }): OrderedMap<string, V>;
|
|
1428
1452
|
|
|
1453
|
+
interface OrderedMap<K, V> extends Map<K, V> {
|
|
1429
1454
|
/**
|
|
1430
1455
|
* The number of entries in this OrderedMap.
|
|
1431
1456
|
*/
|
|
@@ -1473,10 +1498,18 @@ declare module Immutable {
|
|
|
1473
1498
|
*
|
|
1474
1499
|
* @alias concat
|
|
1475
1500
|
*/
|
|
1476
|
-
merge<KC, VC>(
|
|
1477
|
-
|
|
1478
|
-
|
|
1479
|
-
|
|
1501
|
+
merge<KC, VC>(
|
|
1502
|
+
...collections: Array<Iterable<[KC, VC]>>
|
|
1503
|
+
): OrderedMap<K | KC, V | VC>;
|
|
1504
|
+
merge<C>(
|
|
1505
|
+
...collections: Array<{ [key: string]: C }>
|
|
1506
|
+
): OrderedMap<K | string, V | C>;
|
|
1507
|
+
concat<KC, VC>(
|
|
1508
|
+
...collections: Array<Iterable<[KC, VC]>>
|
|
1509
|
+
): OrderedMap<K | KC, V | VC>;
|
|
1510
|
+
concat<C>(
|
|
1511
|
+
...collections: Array<{ [key: string]: C }>
|
|
1512
|
+
): OrderedMap<K | string, V | C>;
|
|
1480
1513
|
|
|
1481
1514
|
// Sequence algorithms
|
|
1482
1515
|
|
|
@@ -1492,7 +1525,7 @@ declare module Immutable {
|
|
|
1492
1525
|
*/
|
|
1493
1526
|
map<M>(
|
|
1494
1527
|
mapper: (value: V, key: K, iter: this) => M,
|
|
1495
|
-
context?:
|
|
1528
|
+
context?: unknown
|
|
1496
1529
|
): OrderedMap<K, M>;
|
|
1497
1530
|
|
|
1498
1531
|
/**
|
|
@@ -1500,15 +1533,19 @@ declare module Immutable {
|
|
|
1500
1533
|
*/
|
|
1501
1534
|
mapKeys<M>(
|
|
1502
1535
|
mapper: (key: K, value: V, iter: this) => M,
|
|
1503
|
-
context?:
|
|
1536
|
+
context?: unknown
|
|
1504
1537
|
): OrderedMap<M, V>;
|
|
1505
1538
|
|
|
1506
1539
|
/**
|
|
1507
1540
|
* @see Collection.Keyed.mapEntries
|
|
1508
1541
|
*/
|
|
1509
1542
|
mapEntries<KM, VM>(
|
|
1510
|
-
mapper: (
|
|
1511
|
-
|
|
1543
|
+
mapper: (
|
|
1544
|
+
entry: [K, V],
|
|
1545
|
+
index: number,
|
|
1546
|
+
iter: this
|
|
1547
|
+
) => [KM, VM] | undefined,
|
|
1548
|
+
context?: unknown
|
|
1512
1549
|
): OrderedMap<KM, VM>;
|
|
1513
1550
|
|
|
1514
1551
|
/**
|
|
@@ -1518,7 +1555,7 @@ declare module Immutable {
|
|
|
1518
1555
|
*/
|
|
1519
1556
|
flatMap<KM, VM>(
|
|
1520
1557
|
mapper: (value: V, key: K, iter: this) => Iterable<[KM, VM]>,
|
|
1521
|
-
context?:
|
|
1558
|
+
context?: unknown
|
|
1522
1559
|
): OrderedMap<KM, VM>;
|
|
1523
1560
|
|
|
1524
1561
|
/**
|
|
@@ -1530,11 +1567,11 @@ declare module Immutable {
|
|
|
1530
1567
|
*/
|
|
1531
1568
|
filter<F extends V>(
|
|
1532
1569
|
predicate: (value: V, key: K, iter: this) => value is F,
|
|
1533
|
-
context?:
|
|
1570
|
+
context?: unknown
|
|
1534
1571
|
): OrderedMap<K, F>;
|
|
1535
1572
|
filter(
|
|
1536
|
-
predicate: (value: V, key: K, iter: this) =>
|
|
1537
|
-
context?:
|
|
1573
|
+
predicate: (value: V, key: K, iter: this) => unknown,
|
|
1574
|
+
context?: unknown
|
|
1538
1575
|
): this;
|
|
1539
1576
|
|
|
1540
1577
|
/**
|
|
@@ -1543,7 +1580,6 @@ declare module Immutable {
|
|
|
1543
1580
|
flip(): OrderedMap<V, K>;
|
|
1544
1581
|
}
|
|
1545
1582
|
|
|
1546
|
-
|
|
1547
1583
|
/**
|
|
1548
1584
|
* A Collection of unique values with `O(log32 N)` adds and has.
|
|
1549
1585
|
*
|
|
@@ -1555,12 +1591,11 @@ declare module Immutable {
|
|
|
1555
1591
|
* `Immutable.is`, enabling Sets to uniquely include other Immutable
|
|
1556
1592
|
* collections, custom value types, and NaN.
|
|
1557
1593
|
*/
|
|
1558
|
-
|
|
1559
|
-
|
|
1594
|
+
namespace Set {
|
|
1560
1595
|
/**
|
|
1561
1596
|
* True if the provided value is a Set
|
|
1562
1597
|
*/
|
|
1563
|
-
function isSet(maybeSet:
|
|
1598
|
+
function isSet(maybeSet: unknown): maybeSet is Set<unknown>;
|
|
1564
1599
|
|
|
1565
1600
|
/**
|
|
1566
1601
|
* Creates a new Set containing `values`.
|
|
@@ -1571,8 +1606,8 @@ declare module Immutable {
|
|
|
1571
1606
|
* `Set.fromKeys()` creates a new immutable Set containing the keys from
|
|
1572
1607
|
* this Collection or JavaScript Object.
|
|
1573
1608
|
*/
|
|
1574
|
-
function fromKeys<T>(iter: Collection<T,
|
|
1575
|
-
function fromKeys(obj: {[key: string]:
|
|
1609
|
+
function fromKeys<T>(iter: Collection<T, unknown>): Set<T>;
|
|
1610
|
+
function fromKeys(obj: { [key: string]: unknown }): Set<string>;
|
|
1576
1611
|
|
|
1577
1612
|
/**
|
|
1578
1613
|
* `Set.intersect()` creates a new immutable Set that is the intersection of
|
|
@@ -1584,7 +1619,7 @@ declare module Immutable {
|
|
|
1584
1619
|
* Set([ 'a', 'b', 'c' ])
|
|
1585
1620
|
* Set([ 'c', 'a', 't' ])
|
|
1586
1621
|
* ])
|
|
1587
|
-
* // Set [ "a", "c"
|
|
1622
|
+
* // Set [ "a", "c" ]
|
|
1588
1623
|
* ```
|
|
1589
1624
|
*/
|
|
1590
1625
|
function intersect<T>(sets: Iterable<Iterable<T>>): Set<T>;
|
|
@@ -1599,7 +1634,7 @@ declare module Immutable {
|
|
|
1599
1634
|
* Set([ 'a', 'b', 'c' ])
|
|
1600
1635
|
* Set([ 'c', 'a', 't' ])
|
|
1601
1636
|
* ])
|
|
1602
|
-
* // Set [ "a", "b", "c", "t"
|
|
1637
|
+
* // Set [ "a", "b", "c", "t" ]
|
|
1603
1638
|
* ```
|
|
1604
1639
|
*/
|
|
1605
1640
|
function union<T>(sets: Iterable<Iterable<T>>): Set<T>;
|
|
@@ -1612,12 +1647,9 @@ declare module Immutable {
|
|
|
1612
1647
|
* Note: `Set` is a factory function and not a class, and does not use the
|
|
1613
1648
|
* `new` keyword during construction.
|
|
1614
1649
|
*/
|
|
1615
|
-
|
|
1616
|
-
export function Set<T>(): Set<T>;
|
|
1617
|
-
export function Set<T>(collection: Iterable<T>): Set<T>;
|
|
1618
|
-
|
|
1619
|
-
export interface Set<T> extends Collection.Set<T> {
|
|
1650
|
+
function Set<T>(collection?: Iterable<T> | ArrayLike<T>): Set<T>;
|
|
1620
1651
|
|
|
1652
|
+
interface Set<T> extends Collection.Set<T> {
|
|
1621
1653
|
/**
|
|
1622
1654
|
* The number of items in this Set.
|
|
1623
1655
|
*/
|
|
@@ -1686,7 +1718,6 @@ declare module Immutable {
|
|
|
1686
1718
|
*/
|
|
1687
1719
|
subtract(...collections: Array<Iterable<T>>): this;
|
|
1688
1720
|
|
|
1689
|
-
|
|
1690
1721
|
// Transient changes
|
|
1691
1722
|
|
|
1692
1723
|
/**
|
|
@@ -1696,7 +1727,7 @@ declare module Immutable {
|
|
|
1696
1727
|
*
|
|
1697
1728
|
* @see `Map#withMutations`
|
|
1698
1729
|
*/
|
|
1699
|
-
withMutations(mutator: (mutable: this) =>
|
|
1730
|
+
withMutations(mutator: (mutable: this) => unknown): this;
|
|
1700
1731
|
|
|
1701
1732
|
/**
|
|
1702
1733
|
* Note: Not all methods can be used on a mutable collection or within
|
|
@@ -1728,7 +1759,7 @@ declare module Immutable {
|
|
|
1728
1759
|
*/
|
|
1729
1760
|
map<M>(
|
|
1730
1761
|
mapper: (value: T, key: T, iter: this) => M,
|
|
1731
|
-
context?:
|
|
1762
|
+
context?: unknown
|
|
1732
1763
|
): Set<M>;
|
|
1733
1764
|
|
|
1734
1765
|
/**
|
|
@@ -1738,7 +1769,7 @@ declare module Immutable {
|
|
|
1738
1769
|
*/
|
|
1739
1770
|
flatMap<M>(
|
|
1740
1771
|
mapper: (value: T, key: T, iter: this) => Iterable<M>,
|
|
1741
|
-
context?:
|
|
1772
|
+
context?: unknown
|
|
1742
1773
|
): Set<M>;
|
|
1743
1774
|
|
|
1744
1775
|
/**
|
|
@@ -1750,15 +1781,14 @@ declare module Immutable {
|
|
|
1750
1781
|
*/
|
|
1751
1782
|
filter<F extends T>(
|
|
1752
1783
|
predicate: (value: T, key: T, iter: this) => value is F,
|
|
1753
|
-
context?:
|
|
1784
|
+
context?: unknown
|
|
1754
1785
|
): Set<F>;
|
|
1755
1786
|
filter(
|
|
1756
|
-
predicate: (value: T, key: T, iter: this) =>
|
|
1757
|
-
context?:
|
|
1787
|
+
predicate: (value: T, key: T, iter: this) => unknown,
|
|
1788
|
+
context?: unknown
|
|
1758
1789
|
): this;
|
|
1759
1790
|
}
|
|
1760
1791
|
|
|
1761
|
-
|
|
1762
1792
|
/**
|
|
1763
1793
|
* A type of Set that has the additional guarantee that the iteration order of
|
|
1764
1794
|
* values will be the order in which they were `add`ed.
|
|
@@ -1769,12 +1799,11 @@ declare module Immutable {
|
|
|
1769
1799
|
* consume more memory. `OrderedSet#add` is amortized O(log32 N), but not
|
|
1770
1800
|
* stable.
|
|
1771
1801
|
*/
|
|
1772
|
-
|
|
1773
|
-
|
|
1802
|
+
namespace OrderedSet {
|
|
1774
1803
|
/**
|
|
1775
1804
|
* True if the provided value is an OrderedSet.
|
|
1776
1805
|
*/
|
|
1777
|
-
function isOrderedSet(maybeOrderedSet:
|
|
1806
|
+
function isOrderedSet(maybeOrderedSet: unknown): boolean;
|
|
1778
1807
|
|
|
1779
1808
|
/**
|
|
1780
1809
|
* Creates a new OrderedSet containing `values`.
|
|
@@ -1785,8 +1814,8 @@ declare module Immutable {
|
|
|
1785
1814
|
* `OrderedSet.fromKeys()` creates a new immutable OrderedSet containing
|
|
1786
1815
|
* the keys from this Collection or JavaScript Object.
|
|
1787
1816
|
*/
|
|
1788
|
-
function fromKeys<T>(iter: Collection<T,
|
|
1789
|
-
function fromKeys(obj: {[key: string]:
|
|
1817
|
+
function fromKeys<T>(iter: Collection<T, unknown>): OrderedSet<T>;
|
|
1818
|
+
function fromKeys(obj: { [key: string]: unknown }): OrderedSet<string>;
|
|
1790
1819
|
}
|
|
1791
1820
|
|
|
1792
1821
|
/**
|
|
@@ -1796,12 +1825,11 @@ declare module Immutable {
|
|
|
1796
1825
|
* Note: `OrderedSet` is a factory function and not a class, and does not use
|
|
1797
1826
|
* the `new` keyword during construction.
|
|
1798
1827
|
*/
|
|
1799
|
-
|
|
1800
|
-
|
|
1801
|
-
|
|
1802
|
-
|
|
1803
|
-
export interface OrderedSet<T> extends Set<T> {
|
|
1828
|
+
function OrderedSet<T>(
|
|
1829
|
+
collection?: Iterable<T> | ArrayLike<T>
|
|
1830
|
+
): OrderedSet<T>;
|
|
1804
1831
|
|
|
1832
|
+
interface OrderedSet<T> extends Set<T> {
|
|
1805
1833
|
/**
|
|
1806
1834
|
* The number of items in this OrderedSet.
|
|
1807
1835
|
*/
|
|
@@ -1830,7 +1858,7 @@ declare module Immutable {
|
|
|
1830
1858
|
*/
|
|
1831
1859
|
map<M>(
|
|
1832
1860
|
mapper: (value: T, key: T, iter: this) => M,
|
|
1833
|
-
context?:
|
|
1861
|
+
context?: unknown
|
|
1834
1862
|
): OrderedSet<M>;
|
|
1835
1863
|
|
|
1836
1864
|
/**
|
|
@@ -1840,7 +1868,7 @@ declare module Immutable {
|
|
|
1840
1868
|
*/
|
|
1841
1869
|
flatMap<M>(
|
|
1842
1870
|
mapper: (value: T, key: T, iter: this) => Iterable<M>,
|
|
1843
|
-
context?:
|
|
1871
|
+
context?: unknown
|
|
1844
1872
|
): OrderedSet<M>;
|
|
1845
1873
|
|
|
1846
1874
|
/**
|
|
@@ -1852,11 +1880,11 @@ declare module Immutable {
|
|
|
1852
1880
|
*/
|
|
1853
1881
|
filter<F extends T>(
|
|
1854
1882
|
predicate: (value: T, key: T, iter: this) => value is F,
|
|
1855
|
-
context?:
|
|
1883
|
+
context?: unknown
|
|
1856
1884
|
): OrderedSet<F>;
|
|
1857
1885
|
filter(
|
|
1858
|
-
predicate: (value: T, key: T, iter: this) =>
|
|
1859
|
-
context?:
|
|
1886
|
+
predicate: (value: T, key: T, iter: this) => unknown,
|
|
1887
|
+
context?: unknown
|
|
1860
1888
|
): this;
|
|
1861
1889
|
|
|
1862
1890
|
/**
|
|
@@ -1872,9 +1900,14 @@ declare module Immutable {
|
|
|
1872
1900
|
* // OrderedSet [ [ 1, 4 ], [ 2, 5 ], [ 3, 6 ] ]
|
|
1873
1901
|
* ```
|
|
1874
1902
|
*/
|
|
1875
|
-
zip<U>(other: Collection<
|
|
1876
|
-
zip<U,V>(
|
|
1877
|
-
|
|
1903
|
+
zip<U>(other: Collection<unknown, U>): OrderedSet<[T, U]>;
|
|
1904
|
+
zip<U, V>(
|
|
1905
|
+
other1: Collection<unknown, U>,
|
|
1906
|
+
other2: Collection<unknown, V>
|
|
1907
|
+
): OrderedSet<[T, U, V]>;
|
|
1908
|
+
zip(
|
|
1909
|
+
...collections: Array<Collection<unknown, unknown>>
|
|
1910
|
+
): OrderedSet<unknown>;
|
|
1878
1911
|
|
|
1879
1912
|
/**
|
|
1880
1913
|
* Returns a OrderedSet of the same type "zipped" with the provided
|
|
@@ -1893,9 +1926,14 @@ declare module Immutable {
|
|
|
1893
1926
|
* input, some results may contain undefined values. TypeScript cannot
|
|
1894
1927
|
* account for these without cases (as of v2.5).
|
|
1895
1928
|
*/
|
|
1896
|
-
zipAll<U>(other: Collection<
|
|
1897
|
-
zipAll<U,V>(
|
|
1898
|
-
|
|
1929
|
+
zipAll<U>(other: Collection<unknown, U>): OrderedSet<[T, U]>;
|
|
1930
|
+
zipAll<U, V>(
|
|
1931
|
+
other1: Collection<unknown, U>,
|
|
1932
|
+
other2: Collection<unknown, V>
|
|
1933
|
+
): OrderedSet<[T, U, V]>;
|
|
1934
|
+
zipAll(
|
|
1935
|
+
...collections: Array<Collection<unknown, unknown>>
|
|
1936
|
+
): OrderedSet<unknown>;
|
|
1899
1937
|
|
|
1900
1938
|
/**
|
|
1901
1939
|
* Returns an OrderedSet of the same type "zipped" with the provided
|
|
@@ -1905,21 +1943,19 @@ declare module Immutable {
|
|
|
1905
1943
|
*/
|
|
1906
1944
|
zipWith<U, Z>(
|
|
1907
1945
|
zipper: (value: T, otherValue: U) => Z,
|
|
1908
|
-
otherCollection: Collection<
|
|
1946
|
+
otherCollection: Collection<unknown, U>
|
|
1909
1947
|
): OrderedSet<Z>;
|
|
1910
1948
|
zipWith<U, V, Z>(
|
|
1911
1949
|
zipper: (value: T, otherValue: U, thirdValue: V) => Z,
|
|
1912
|
-
otherCollection: Collection<
|
|
1913
|
-
thirdCollection: Collection<
|
|
1950
|
+
otherCollection: Collection<unknown, U>,
|
|
1951
|
+
thirdCollection: Collection<unknown, V>
|
|
1914
1952
|
): OrderedSet<Z>;
|
|
1915
1953
|
zipWith<Z>(
|
|
1916
|
-
zipper: (...
|
|
1917
|
-
...collections: Array<Collection<
|
|
1954
|
+
zipper: (...values: Array<unknown>) => Z,
|
|
1955
|
+
...collections: Array<Collection<unknown, unknown>>
|
|
1918
1956
|
): OrderedSet<Z>;
|
|
1919
|
-
|
|
1920
1957
|
}
|
|
1921
1958
|
|
|
1922
|
-
|
|
1923
1959
|
/**
|
|
1924
1960
|
* Stacks are indexed collections which support very efficient O(1) addition
|
|
1925
1961
|
* and removal from the front using `unshift(v)` and `shift()`.
|
|
@@ -1933,12 +1969,11 @@ declare module Immutable {
|
|
|
1933
1969
|
*
|
|
1934
1970
|
* Stack is implemented with a Single-Linked List.
|
|
1935
1971
|
*/
|
|
1936
|
-
|
|
1937
|
-
|
|
1972
|
+
namespace Stack {
|
|
1938
1973
|
/**
|
|
1939
1974
|
* True if the provided value is a Stack
|
|
1940
1975
|
*/
|
|
1941
|
-
function isStack(maybeStack:
|
|
1976
|
+
function isStack(maybeStack: unknown): maybeStack is Stack<unknown>;
|
|
1942
1977
|
|
|
1943
1978
|
/**
|
|
1944
1979
|
* Creates a new Stack containing `values`.
|
|
@@ -1956,12 +1991,9 @@ declare module Immutable {
|
|
|
1956
1991
|
* Note: `Stack` is a factory function and not a class, and does not use the
|
|
1957
1992
|
* `new` keyword during construction.
|
|
1958
1993
|
*/
|
|
1959
|
-
|
|
1960
|
-
export function Stack<T>(): Stack<T>;
|
|
1961
|
-
export function Stack<T>(collection: Iterable<T>): Stack<T>;
|
|
1962
|
-
|
|
1963
|
-
export interface Stack<T> extends Collection.Indexed<T> {
|
|
1994
|
+
function Stack<T>(collection?: Iterable<T> | ArrayLike<T>): Stack<T>;
|
|
1964
1995
|
|
|
1996
|
+
interface Stack<T> extends Collection.Indexed<T> {
|
|
1965
1997
|
/**
|
|
1966
1998
|
* The number of items in this Stack.
|
|
1967
1999
|
*/
|
|
@@ -1974,7 +2006,6 @@ declare module Immutable {
|
|
|
1974
2006
|
*/
|
|
1975
2007
|
peek(): T | undefined;
|
|
1976
2008
|
|
|
1977
|
-
|
|
1978
2009
|
// Persistent changes
|
|
1979
2010
|
|
|
1980
2011
|
/**
|
|
@@ -2028,7 +2059,6 @@ declare module Immutable {
|
|
|
2028
2059
|
*/
|
|
2029
2060
|
pop(): Stack<T>;
|
|
2030
2061
|
|
|
2031
|
-
|
|
2032
2062
|
// Transient changes
|
|
2033
2063
|
|
|
2034
2064
|
/**
|
|
@@ -2038,7 +2068,7 @@ declare module Immutable {
|
|
|
2038
2068
|
*
|
|
2039
2069
|
* @see `Map#withMutations`
|
|
2040
2070
|
*/
|
|
2041
|
-
withMutations(mutator: (mutable: this) =>
|
|
2071
|
+
withMutations(mutator: (mutable: this) => unknown): this;
|
|
2042
2072
|
|
|
2043
2073
|
/**
|
|
2044
2074
|
* Note: Not all methods can be used on a mutable collection or within
|
|
@@ -2078,7 +2108,7 @@ declare module Immutable {
|
|
|
2078
2108
|
*/
|
|
2079
2109
|
map<M>(
|
|
2080
2110
|
mapper: (value: T, key: number, iter: this) => M,
|
|
2081
|
-
context?:
|
|
2111
|
+
context?: unknown
|
|
2082
2112
|
): Stack<M>;
|
|
2083
2113
|
|
|
2084
2114
|
/**
|
|
@@ -2088,7 +2118,7 @@ declare module Immutable {
|
|
|
2088
2118
|
*/
|
|
2089
2119
|
flatMap<M>(
|
|
2090
2120
|
mapper: (value: T, key: number, iter: this) => Iterable<M>,
|
|
2091
|
-
context?:
|
|
2121
|
+
context?: unknown
|
|
2092
2122
|
): Stack<M>;
|
|
2093
2123
|
|
|
2094
2124
|
/**
|
|
@@ -2100,11 +2130,11 @@ declare module Immutable {
|
|
|
2100
2130
|
*/
|
|
2101
2131
|
filter<F extends T>(
|
|
2102
2132
|
predicate: (value: T, index: number, iter: this) => value is F,
|
|
2103
|
-
context?:
|
|
2133
|
+
context?: unknown
|
|
2104
2134
|
): Set<F>;
|
|
2105
2135
|
filter(
|
|
2106
|
-
predicate: (value: T, index: number, iter: this) =>
|
|
2107
|
-
context?:
|
|
2136
|
+
predicate: (value: T, index: number, iter: this) => unknown,
|
|
2137
|
+
context?: unknown
|
|
2108
2138
|
): this;
|
|
2109
2139
|
|
|
2110
2140
|
/**
|
|
@@ -2118,9 +2148,12 @@ declare module Immutable {
|
|
|
2118
2148
|
* const c = a.zip(b); // Stack [ [ 1, 4 ], [ 2, 5 ], [ 3, 6 ] ]
|
|
2119
2149
|
* ```
|
|
2120
2150
|
*/
|
|
2121
|
-
zip<U>(other: Collection<
|
|
2122
|
-
zip<U,V>(
|
|
2123
|
-
|
|
2151
|
+
zip<U>(other: Collection<unknown, U>): Stack<[T, U]>;
|
|
2152
|
+
zip<U, V>(
|
|
2153
|
+
other: Collection<unknown, U>,
|
|
2154
|
+
other2: Collection<unknown, V>
|
|
2155
|
+
): Stack<[T, U, V]>;
|
|
2156
|
+
zip(...collections: Array<Collection<unknown, unknown>>): Stack<unknown>;
|
|
2124
2157
|
|
|
2125
2158
|
/**
|
|
2126
2159
|
* Returns a Stack "zipped" with the provided collections.
|
|
@@ -2138,9 +2171,12 @@ declare module Immutable {
|
|
|
2138
2171
|
* input, some results may contain undefined values. TypeScript cannot
|
|
2139
2172
|
* account for these without cases (as of v2.5).
|
|
2140
2173
|
*/
|
|
2141
|
-
zipAll<U>(other: Collection<
|
|
2142
|
-
zipAll<U,V>(
|
|
2143
|
-
|
|
2174
|
+
zipAll<U>(other: Collection<unknown, U>): Stack<[T, U]>;
|
|
2175
|
+
zipAll<U, V>(
|
|
2176
|
+
other: Collection<unknown, U>,
|
|
2177
|
+
other2: Collection<unknown, V>
|
|
2178
|
+
): Stack<[T, U, V]>;
|
|
2179
|
+
zipAll(...collections: Array<Collection<unknown, unknown>>): Stack<unknown>;
|
|
2144
2180
|
|
|
2145
2181
|
/**
|
|
2146
2182
|
* Returns a Stack "zipped" with the provided collections by using a
|
|
@@ -2155,20 +2191,19 @@ declare module Immutable {
|
|
|
2155
2191
|
*/
|
|
2156
2192
|
zipWith<U, Z>(
|
|
2157
2193
|
zipper: (value: T, otherValue: U) => Z,
|
|
2158
|
-
otherCollection: Collection<
|
|
2194
|
+
otherCollection: Collection<unknown, U>
|
|
2159
2195
|
): Stack<Z>;
|
|
2160
2196
|
zipWith<U, V, Z>(
|
|
2161
2197
|
zipper: (value: T, otherValue: U, thirdValue: V) => Z,
|
|
2162
|
-
otherCollection: Collection<
|
|
2163
|
-
thirdCollection: Collection<
|
|
2198
|
+
otherCollection: Collection<unknown, U>,
|
|
2199
|
+
thirdCollection: Collection<unknown, V>
|
|
2164
2200
|
): Stack<Z>;
|
|
2165
2201
|
zipWith<Z>(
|
|
2166
|
-
zipper: (...
|
|
2167
|
-
...collections: Array<Collection<
|
|
2202
|
+
zipper: (...values: Array<unknown>) => Z,
|
|
2203
|
+
...collections: Array<Collection<unknown, unknown>>
|
|
2168
2204
|
): Stack<Z>;
|
|
2169
2205
|
}
|
|
2170
2206
|
|
|
2171
|
-
|
|
2172
2207
|
/**
|
|
2173
2208
|
* Returns a Seq.Indexed of numbers from `start` (inclusive) to `end`
|
|
2174
2209
|
* (exclusive), by `step`, where `start` defaults to 0, `step` to 1, and `end` to
|
|
@@ -2187,8 +2222,11 @@ declare module Immutable {
|
|
|
2187
2222
|
* Range(30, 30, 5) // []
|
|
2188
2223
|
* ```
|
|
2189
2224
|
*/
|
|
2190
|
-
|
|
2191
|
-
|
|
2225
|
+
function Range(
|
|
2226
|
+
start?: number,
|
|
2227
|
+
end?: number,
|
|
2228
|
+
step?: number
|
|
2229
|
+
): Seq.Indexed<number>;
|
|
2192
2230
|
|
|
2193
2231
|
/**
|
|
2194
2232
|
* Returns a Seq.Indexed of `value` repeated `times` times. When `times` is
|
|
@@ -2203,8 +2241,7 @@ declare module Immutable {
|
|
|
2203
2241
|
* Repeat('bar', 4) // [ 'bar', 'bar', 'bar', 'bar' ]
|
|
2204
2242
|
* ```
|
|
2205
2243
|
*/
|
|
2206
|
-
|
|
2207
|
-
|
|
2244
|
+
function Repeat<T>(value: T, times?: number): Seq.Indexed<T>;
|
|
2208
2245
|
|
|
2209
2246
|
/**
|
|
2210
2247
|
* A record is similar to a JS object, but enforces a specific set of allowed
|
|
@@ -2223,12 +2260,10 @@ declare module Immutable {
|
|
|
2223
2260
|
* from a record simply resets it to the default value for that key.
|
|
2224
2261
|
*
|
|
2225
2262
|
* ```js
|
|
2226
|
-
* myRecord.size // 2
|
|
2227
2263
|
* myRecord.get('a') // 1
|
|
2228
2264
|
* myRecord.get('b') // 3
|
|
2229
2265
|
* const myRecordWithoutB = myRecord.remove('b')
|
|
2230
2266
|
* myRecordWithoutB.get('b') // 2
|
|
2231
|
-
* myRecordWithoutB.size // 2
|
|
2232
2267
|
* ```
|
|
2233
2268
|
*
|
|
2234
2269
|
* Values provided to the constructor not found in the Record type will
|
|
@@ -2367,12 +2402,11 @@ declare module Immutable {
|
|
|
2367
2402
|
* form isn't free. If converting Records to plain objects is common,
|
|
2368
2403
|
* consider sticking with plain objects to begin with.
|
|
2369
2404
|
*/
|
|
2370
|
-
|
|
2371
|
-
|
|
2405
|
+
namespace Record {
|
|
2372
2406
|
/**
|
|
2373
2407
|
* True if `maybeRecord` is an instance of a Record.
|
|
2374
2408
|
*/
|
|
2375
|
-
|
|
2409
|
+
function isRecord(maybeRecord: unknown): maybeRecord is Record<{}>;
|
|
2376
2410
|
|
|
2377
2411
|
/**
|
|
2378
2412
|
* Records allow passing a second parameter to supply a descriptive name
|
|
@@ -2391,7 +2425,7 @@ declare module Immutable {
|
|
|
2391
2425
|
* Record.getDescriptiveName(me) // "Person"
|
|
2392
2426
|
* ```
|
|
2393
2427
|
*/
|
|
2394
|
-
|
|
2428
|
+
function getDescriptiveName(record: Record<any>): string;
|
|
2395
2429
|
|
|
2396
2430
|
/**
|
|
2397
2431
|
* A Record.Factory is created by the `Record()` function. Record instances
|
|
@@ -2441,14 +2475,25 @@ declare module Immutable {
|
|
|
2441
2475
|
* const alan: Person = makePerson({ name: 'Alan' });
|
|
2442
2476
|
* ```
|
|
2443
2477
|
*/
|
|
2444
|
-
|
|
2478
|
+
namespace Factory {}
|
|
2445
2479
|
|
|
2446
|
-
|
|
2447
|
-
(values?: Partial<TProps> | Iterable<[string,
|
|
2448
|
-
|
|
2480
|
+
interface Factory<TProps extends object> {
|
|
2481
|
+
(values?: Partial<TProps> | Iterable<[string, unknown]>): Record<TProps> &
|
|
2482
|
+
Readonly<TProps>;
|
|
2483
|
+
new (
|
|
2484
|
+
values?: Partial<TProps> | Iterable<[string, unknown]>
|
|
2485
|
+
): Record<TProps> & Readonly<TProps>;
|
|
2486
|
+
|
|
2487
|
+
/**
|
|
2488
|
+
* The name provided to `Record(values, name)` can be accessed with
|
|
2489
|
+
* `displayName`.
|
|
2490
|
+
*/
|
|
2491
|
+
displayName: string;
|
|
2449
2492
|
}
|
|
2450
2493
|
|
|
2451
|
-
|
|
2494
|
+
function Factory<TProps extends object>(
|
|
2495
|
+
values?: Partial<TProps> | Iterable<[string, unknown]>
|
|
2496
|
+
): Record<TProps> & Readonly<TProps>;
|
|
2452
2497
|
}
|
|
2453
2498
|
|
|
2454
2499
|
/**
|
|
@@ -2460,10 +2505,12 @@ declare module Immutable {
|
|
|
2460
2505
|
* Note: `Record` is a factory function and not a class, and does not use the
|
|
2461
2506
|
* `new` keyword during construction.
|
|
2462
2507
|
*/
|
|
2463
|
-
|
|
2464
|
-
|
|
2465
|
-
|
|
2508
|
+
function Record<TProps extends object>(
|
|
2509
|
+
defaultValues: TProps,
|
|
2510
|
+
name?: string
|
|
2511
|
+
): Record.Factory<TProps>;
|
|
2466
2512
|
|
|
2513
|
+
interface Record<TProps extends object> {
|
|
2467
2514
|
// Reading values
|
|
2468
2515
|
|
|
2469
2516
|
has(key: string): key is keyof TProps & string;
|
|
@@ -2476,33 +2523,40 @@ declare module Immutable {
|
|
|
2476
2523
|
* notSetValue will be returned if provided. Note that this scenario would
|
|
2477
2524
|
* produce an error when using Flow or TypeScript.
|
|
2478
2525
|
*/
|
|
2479
|
-
get<K extends keyof TProps>(key: K, notSetValue?:
|
|
2526
|
+
get<K extends keyof TProps>(key: K, notSetValue?: unknown): TProps[K];
|
|
2480
2527
|
get<T>(key: string, notSetValue: T): T;
|
|
2481
2528
|
|
|
2482
2529
|
// Reading deep values
|
|
2483
2530
|
|
|
2484
|
-
hasIn(keyPath: Iterable<
|
|
2485
|
-
getIn(keyPath: Iterable<
|
|
2531
|
+
hasIn(keyPath: Iterable<unknown>): boolean;
|
|
2532
|
+
getIn(keyPath: Iterable<unknown>): unknown;
|
|
2486
2533
|
|
|
2487
2534
|
// Value equality
|
|
2488
2535
|
|
|
2489
|
-
equals(other:
|
|
2536
|
+
equals(other: unknown): boolean;
|
|
2490
2537
|
hashCode(): number;
|
|
2491
2538
|
|
|
2492
2539
|
// Persistent changes
|
|
2493
2540
|
|
|
2494
2541
|
set<K extends keyof TProps>(key: K, value: TProps[K]): this;
|
|
2495
|
-
update<K extends keyof TProps>(
|
|
2496
|
-
|
|
2497
|
-
|
|
2542
|
+
update<K extends keyof TProps>(
|
|
2543
|
+
key: K,
|
|
2544
|
+
updater: (value: TProps[K]) => TProps[K]
|
|
2545
|
+
): this;
|
|
2546
|
+
merge(
|
|
2547
|
+
...collections: Array<Partial<TProps> | Iterable<[string, unknown]>>
|
|
2548
|
+
): this;
|
|
2549
|
+
mergeDeep(
|
|
2550
|
+
...collections: Array<Partial<TProps> | Iterable<[string, unknown]>>
|
|
2551
|
+
): this;
|
|
2498
2552
|
|
|
2499
2553
|
mergeWith(
|
|
2500
|
-
merger: (oldVal:
|
|
2501
|
-
...collections: Array<Partial<TProps> | Iterable<[string,
|
|
2554
|
+
merger: (oldVal: unknown, newVal: unknown, key: keyof TProps) => unknown,
|
|
2555
|
+
...collections: Array<Partial<TProps> | Iterable<[string, unknown]>>
|
|
2502
2556
|
): this;
|
|
2503
2557
|
mergeDeepWith(
|
|
2504
|
-
merger: (oldVal:
|
|
2505
|
-
...collections: Array<Partial<TProps> | Iterable<[string,
|
|
2558
|
+
merger: (oldVal: unknown, newVal: unknown, key: unknown) => unknown,
|
|
2559
|
+
...collections: Array<Partial<TProps> | Iterable<[string, unknown]>>
|
|
2506
2560
|
): this;
|
|
2507
2561
|
|
|
2508
2562
|
/**
|
|
@@ -2522,16 +2576,22 @@ declare module Immutable {
|
|
|
2522
2576
|
|
|
2523
2577
|
// Deep persistent changes
|
|
2524
2578
|
|
|
2525
|
-
setIn(keyPath: Iterable<
|
|
2526
|
-
updateIn(
|
|
2527
|
-
|
|
2528
|
-
|
|
2579
|
+
setIn(keyPath: Iterable<unknown>, value: unknown): this;
|
|
2580
|
+
updateIn(
|
|
2581
|
+
keyPath: Iterable<unknown>,
|
|
2582
|
+
updater: (value: unknown) => unknown
|
|
2583
|
+
): this;
|
|
2584
|
+
mergeIn(keyPath: Iterable<unknown>, ...collections: Array<unknown>): this;
|
|
2585
|
+
mergeDeepIn(
|
|
2586
|
+
keyPath: Iterable<unknown>,
|
|
2587
|
+
...collections: Array<unknown>
|
|
2588
|
+
): this;
|
|
2529
2589
|
|
|
2530
2590
|
/**
|
|
2531
2591
|
* @alias removeIn
|
|
2532
2592
|
*/
|
|
2533
|
-
deleteIn(keyPath: Iterable<
|
|
2534
|
-
removeIn(keyPath: Iterable<
|
|
2593
|
+
deleteIn(keyPath: Iterable<unknown>): this;
|
|
2594
|
+
removeIn(keyPath: Iterable<unknown>): this;
|
|
2535
2595
|
|
|
2536
2596
|
// Conversion to JavaScript types
|
|
2537
2597
|
|
|
@@ -2541,7 +2601,7 @@ declare module Immutable {
|
|
|
2541
2601
|
* Note: This method may not be overridden. Objects with custom
|
|
2542
2602
|
* serialization to plain JS may override toJSON() instead.
|
|
2543
2603
|
*/
|
|
2544
|
-
toJS(): { [K in keyof TProps]:
|
|
2604
|
+
toJS(): { [K in keyof TProps]: unknown };
|
|
2545
2605
|
|
|
2546
2606
|
/**
|
|
2547
2607
|
* Shallowly converts this Record to equivalent native JavaScript Object.
|
|
@@ -2561,7 +2621,7 @@ declare module Immutable {
|
|
|
2561
2621
|
*
|
|
2562
2622
|
* @see `Map#withMutations`
|
|
2563
2623
|
*/
|
|
2564
|
-
withMutations(mutator: (mutable: this) =>
|
|
2624
|
+
withMutations(mutator: (mutable: this) => unknown): this;
|
|
2565
2625
|
|
|
2566
2626
|
/**
|
|
2567
2627
|
* @see `Map#asMutable`
|
|
@@ -2591,8 +2651,7 @@ declare module Immutable {
|
|
|
2591
2651
|
*
|
|
2592
2652
|
* This is equivalent to an instance of a record created by a Record Factory.
|
|
2593
2653
|
*/
|
|
2594
|
-
|
|
2595
|
-
Readonly<TProps>;
|
|
2654
|
+
type RecordOf<TProps extends object> = Record<TProps> & Readonly<TProps>;
|
|
2596
2655
|
|
|
2597
2656
|
/**
|
|
2598
2657
|
* `Seq` describes a lazy operation, allowing them to efficiently chain
|
|
@@ -2631,7 +2690,7 @@ declare module Immutable {
|
|
|
2631
2690
|
* <!-- runkit:activate -->
|
|
2632
2691
|
* ```js
|
|
2633
2692
|
* const { Map } = require('immutable')
|
|
2634
|
-
* const map = Map({ a: 1, b: 2, c: 3 }
|
|
2693
|
+
* const map = Map({ a: 1, b: 2, c: 3 })
|
|
2635
2694
|
* const lazySeq = Seq(map)
|
|
2636
2695
|
* ```
|
|
2637
2696
|
*
|
|
@@ -2669,18 +2728,22 @@ declare module Immutable {
|
|
|
2669
2728
|
* ```
|
|
2670
2729
|
*/
|
|
2671
2730
|
|
|
2672
|
-
|
|
2731
|
+
namespace Seq {
|
|
2673
2732
|
/**
|
|
2674
2733
|
* True if `maybeSeq` is a Seq, it is not backed by a concrete
|
|
2675
2734
|
* structure such as Map, List, or Set.
|
|
2676
2735
|
*/
|
|
2677
|
-
function isSeq(
|
|
2678
|
-
|
|
2736
|
+
function isSeq(
|
|
2737
|
+
maybeSeq: unknown
|
|
2738
|
+
): maybeSeq is
|
|
2739
|
+
| Seq.Indexed<unknown>
|
|
2740
|
+
| Seq.Keyed<unknown, unknown>
|
|
2741
|
+
| Seq.Set<unknown>;
|
|
2679
2742
|
|
|
2680
2743
|
/**
|
|
2681
2744
|
* `Seq` which represents key-value pairs.
|
|
2682
2745
|
*/
|
|
2683
|
-
|
|
2746
|
+
namespace Keyed {}
|
|
2684
2747
|
|
|
2685
2748
|
/**
|
|
2686
2749
|
* Always returns a Seq.Keyed, if input is not keyed, expects an
|
|
@@ -2689,18 +2752,16 @@ declare module Immutable {
|
|
|
2689
2752
|
* Note: `Seq.Keyed` is a conversion function and not a class, and does not
|
|
2690
2753
|
* use the `new` keyword during construction.
|
|
2691
2754
|
*/
|
|
2692
|
-
|
|
2693
|
-
|
|
2694
|
-
export function Keyed<K, V>(): Seq.Keyed<K, V>;
|
|
2695
|
-
export function Keyed(): Seq.Keyed<any, any>;
|
|
2755
|
+
function Keyed<K, V>(collection?: Iterable<[K, V]>): Seq.Keyed<K, V>;
|
|
2756
|
+
function Keyed<V>(obj: { [key: string]: V }): Seq.Keyed<string, V>;
|
|
2696
2757
|
|
|
2697
|
-
|
|
2758
|
+
interface Keyed<K, V> extends Seq<K, V>, Collection.Keyed<K, V> {
|
|
2698
2759
|
/**
|
|
2699
2760
|
* Deeply converts this Keyed Seq to equivalent native JavaScript Object.
|
|
2700
2761
|
*
|
|
2701
2762
|
* Converts keys to Strings.
|
|
2702
2763
|
*/
|
|
2703
|
-
toJS():
|
|
2764
|
+
toJS(): { [key: string]: unknown };
|
|
2704
2765
|
|
|
2705
2766
|
/**
|
|
2706
2767
|
* Shallowly converts this Keyed Seq to equivalent native JavaScript Object.
|
|
@@ -2725,8 +2786,12 @@ declare module Immutable {
|
|
|
2725
2786
|
* All entries will be present in the resulting Seq, even if they
|
|
2726
2787
|
* have the same key.
|
|
2727
2788
|
*/
|
|
2728
|
-
concat<KC, VC>(
|
|
2729
|
-
|
|
2789
|
+
concat<KC, VC>(
|
|
2790
|
+
...collections: Array<Iterable<[KC, VC]>>
|
|
2791
|
+
): Seq.Keyed<K | KC, V | VC>;
|
|
2792
|
+
concat<C>(
|
|
2793
|
+
...collections: Array<{ [key: string]: C }>
|
|
2794
|
+
): Seq.Keyed<K | string, V | C>;
|
|
2730
2795
|
|
|
2731
2796
|
/**
|
|
2732
2797
|
* Returns a new Seq.Keyed with values passed through a
|
|
@@ -2743,7 +2808,7 @@ declare module Immutable {
|
|
|
2743
2808
|
*/
|
|
2744
2809
|
map<M>(
|
|
2745
2810
|
mapper: (value: V, key: K, iter: this) => M,
|
|
2746
|
-
context?:
|
|
2811
|
+
context?: unknown
|
|
2747
2812
|
): Seq.Keyed<K, M>;
|
|
2748
2813
|
|
|
2749
2814
|
/**
|
|
@@ -2751,15 +2816,19 @@ declare module Immutable {
|
|
|
2751
2816
|
*/
|
|
2752
2817
|
mapKeys<M>(
|
|
2753
2818
|
mapper: (key: K, value: V, iter: this) => M,
|
|
2754
|
-
context?:
|
|
2819
|
+
context?: unknown
|
|
2755
2820
|
): Seq.Keyed<M, V>;
|
|
2756
2821
|
|
|
2757
2822
|
/**
|
|
2758
2823
|
* @see Collection.Keyed.mapEntries
|
|
2759
2824
|
*/
|
|
2760
2825
|
mapEntries<KM, VM>(
|
|
2761
|
-
mapper: (
|
|
2762
|
-
|
|
2826
|
+
mapper: (
|
|
2827
|
+
entry: [K, V],
|
|
2828
|
+
index: number,
|
|
2829
|
+
iter: this
|
|
2830
|
+
) => [KM, VM] | undefined,
|
|
2831
|
+
context?: unknown
|
|
2763
2832
|
): Seq.Keyed<KM, VM>;
|
|
2764
2833
|
|
|
2765
2834
|
/**
|
|
@@ -2769,7 +2838,7 @@ declare module Immutable {
|
|
|
2769
2838
|
*/
|
|
2770
2839
|
flatMap<KM, VM>(
|
|
2771
2840
|
mapper: (value: V, key: K, iter: this) => Iterable<[KM, VM]>,
|
|
2772
|
-
context?:
|
|
2841
|
+
context?: unknown
|
|
2773
2842
|
): Seq.Keyed<KM, VM>;
|
|
2774
2843
|
|
|
2775
2844
|
/**
|
|
@@ -2781,25 +2850,25 @@ declare module Immutable {
|
|
|
2781
2850
|
*/
|
|
2782
2851
|
filter<F extends V>(
|
|
2783
2852
|
predicate: (value: V, key: K, iter: this) => value is F,
|
|
2784
|
-
context?:
|
|
2853
|
+
context?: unknown
|
|
2785
2854
|
): Seq.Keyed<K, F>;
|
|
2786
2855
|
filter(
|
|
2787
|
-
predicate: (value: V, key: K, iter: this) =>
|
|
2788
|
-
context?:
|
|
2856
|
+
predicate: (value: V, key: K, iter: this) => unknown,
|
|
2857
|
+
context?: unknown
|
|
2789
2858
|
): this;
|
|
2790
2859
|
|
|
2791
2860
|
/**
|
|
2792
2861
|
* @see Collection.Keyed.flip
|
|
2793
2862
|
*/
|
|
2794
2863
|
flip(): Seq.Keyed<V, K>;
|
|
2795
|
-
}
|
|
2796
2864
|
|
|
2865
|
+
[Symbol.iterator](): IterableIterator<[K, V]>;
|
|
2866
|
+
}
|
|
2797
2867
|
|
|
2798
2868
|
/**
|
|
2799
2869
|
* `Seq` which represents an ordered indexed list of values.
|
|
2800
2870
|
*/
|
|
2801
|
-
|
|
2802
|
-
|
|
2871
|
+
namespace Indexed {
|
|
2803
2872
|
/**
|
|
2804
2873
|
* Provides an Seq.Indexed of the values provided.
|
|
2805
2874
|
*/
|
|
@@ -2813,15 +2882,13 @@ declare module Immutable {
|
|
|
2813
2882
|
* Note: `Seq.Indexed` is a conversion function and not a class, and does
|
|
2814
2883
|
* not use the `new` keyword during construction.
|
|
2815
2884
|
*/
|
|
2816
|
-
|
|
2817
|
-
export function Indexed<T>(): Seq.Indexed<T>;
|
|
2818
|
-
export function Indexed<T>(collection: Iterable<T>): Seq.Indexed<T>;
|
|
2885
|
+
function Indexed<T>(collection: Iterable<T> | ArrayLike<T>): Seq.Indexed<T>;
|
|
2819
2886
|
|
|
2820
|
-
|
|
2887
|
+
interface Indexed<T> extends Seq<number, T>, Collection.Indexed<T> {
|
|
2821
2888
|
/**
|
|
2822
2889
|
* Deeply converts this Indexed Seq to equivalent native JavaScript Array.
|
|
2823
2890
|
*/
|
|
2824
|
-
toJS(): Array<
|
|
2891
|
+
toJS(): Array<unknown>;
|
|
2825
2892
|
|
|
2826
2893
|
/**
|
|
2827
2894
|
* Shallowly converts this Indexed Seq to equivalent native JavaScript Array.
|
|
@@ -2836,12 +2903,14 @@ declare module Immutable {
|
|
|
2836
2903
|
/**
|
|
2837
2904
|
* Returns itself
|
|
2838
2905
|
*/
|
|
2839
|
-
toSeq(): this
|
|
2906
|
+
toSeq(): this;
|
|
2840
2907
|
|
|
2841
2908
|
/**
|
|
2842
2909
|
* Returns a new Seq with other collections concatenated to this one.
|
|
2843
2910
|
*/
|
|
2844
|
-
concat<C>(
|
|
2911
|
+
concat<C>(
|
|
2912
|
+
...valuesOrCollections: Array<Iterable<C> | C>
|
|
2913
|
+
): Seq.Indexed<T | C>;
|
|
2845
2914
|
|
|
2846
2915
|
/**
|
|
2847
2916
|
* Returns a new Seq.Indexed with values passed through a
|
|
@@ -2858,7 +2927,7 @@ declare module Immutable {
|
|
|
2858
2927
|
*/
|
|
2859
2928
|
map<M>(
|
|
2860
2929
|
mapper: (value: T, key: number, iter: this) => M,
|
|
2861
|
-
context?:
|
|
2930
|
+
context?: unknown
|
|
2862
2931
|
): Seq.Indexed<M>;
|
|
2863
2932
|
|
|
2864
2933
|
/**
|
|
@@ -2868,7 +2937,7 @@ declare module Immutable {
|
|
|
2868
2937
|
*/
|
|
2869
2938
|
flatMap<M>(
|
|
2870
2939
|
mapper: (value: T, key: number, iter: this) => Iterable<M>,
|
|
2871
|
-
context?:
|
|
2940
|
+
context?: unknown
|
|
2872
2941
|
): Seq.Indexed<M>;
|
|
2873
2942
|
|
|
2874
2943
|
/**
|
|
@@ -2880,11 +2949,11 @@ declare module Immutable {
|
|
|
2880
2949
|
*/
|
|
2881
2950
|
filter<F extends T>(
|
|
2882
2951
|
predicate: (value: T, index: number, iter: this) => value is F,
|
|
2883
|
-
context?:
|
|
2952
|
+
context?: unknown
|
|
2884
2953
|
): Seq.Indexed<F>;
|
|
2885
2954
|
filter(
|
|
2886
|
-
predicate: (value: T, index: number, iter: this) =>
|
|
2887
|
-
context?:
|
|
2955
|
+
predicate: (value: T, index: number, iter: this) => unknown,
|
|
2956
|
+
context?: unknown
|
|
2888
2957
|
): this;
|
|
2889
2958
|
|
|
2890
2959
|
/**
|
|
@@ -2898,9 +2967,14 @@ declare module Immutable {
|
|
|
2898
2967
|
* const c = a.zip(b); // Seq [ [ 1, 4 ], [ 2, 5 ], [ 3, 6 ] ]
|
|
2899
2968
|
* ```
|
|
2900
2969
|
*/
|
|
2901
|
-
zip<U>(other: Collection<
|
|
2902
|
-
zip<U,V>(
|
|
2903
|
-
|
|
2970
|
+
zip<U>(other: Collection<unknown, U>): Seq.Indexed<[T, U]>;
|
|
2971
|
+
zip<U, V>(
|
|
2972
|
+
other: Collection<unknown, U>,
|
|
2973
|
+
other2: Collection<unknown, V>
|
|
2974
|
+
): Seq.Indexed<[T, U, V]>;
|
|
2975
|
+
zip(
|
|
2976
|
+
...collections: Array<Collection<unknown, unknown>>
|
|
2977
|
+
): Seq.Indexed<unknown>;
|
|
2904
2978
|
|
|
2905
2979
|
/**
|
|
2906
2980
|
* Returns a Seq "zipped" with the provided collections.
|
|
@@ -2914,9 +2988,14 @@ declare module Immutable {
|
|
|
2914
2988
|
* const c = a.zipAll(b); // Seq [ [ 1, 3 ], [ 2, 4 ], [ undefined, 5 ] ]
|
|
2915
2989
|
* ```
|
|
2916
2990
|
*/
|
|
2917
|
-
zipAll<U>(other: Collection<
|
|
2918
|
-
zipAll<U,V>(
|
|
2919
|
-
|
|
2991
|
+
zipAll<U>(other: Collection<unknown, U>): Seq.Indexed<[T, U]>;
|
|
2992
|
+
zipAll<U, V>(
|
|
2993
|
+
other: Collection<unknown, U>,
|
|
2994
|
+
other2: Collection<unknown, V>
|
|
2995
|
+
): Seq.Indexed<[T, U, V]>;
|
|
2996
|
+
zipAll(
|
|
2997
|
+
...collections: Array<Collection<unknown, unknown>>
|
|
2998
|
+
): Seq.Indexed<unknown>;
|
|
2920
2999
|
|
|
2921
3000
|
/**
|
|
2922
3001
|
* Returns a Seq "zipped" with the provided collections by using a
|
|
@@ -2931,19 +3010,20 @@ declare module Immutable {
|
|
|
2931
3010
|
*/
|
|
2932
3011
|
zipWith<U, Z>(
|
|
2933
3012
|
zipper: (value: T, otherValue: U) => Z,
|
|
2934
|
-
otherCollection: Collection<
|
|
3013
|
+
otherCollection: Collection<unknown, U>
|
|
2935
3014
|
): Seq.Indexed<Z>;
|
|
2936
3015
|
zipWith<U, V, Z>(
|
|
2937
3016
|
zipper: (value: T, otherValue: U, thirdValue: V) => Z,
|
|
2938
|
-
otherCollection: Collection<
|
|
2939
|
-
thirdCollection: Collection<
|
|
3017
|
+
otherCollection: Collection<unknown, U>,
|
|
3018
|
+
thirdCollection: Collection<unknown, V>
|
|
2940
3019
|
): Seq.Indexed<Z>;
|
|
2941
3020
|
zipWith<Z>(
|
|
2942
|
-
zipper: (...
|
|
2943
|
-
...collections: Array<Collection<
|
|
3021
|
+
zipper: (...values: Array<unknown>) => Z,
|
|
3022
|
+
...collections: Array<Collection<unknown, unknown>>
|
|
2944
3023
|
): Seq.Indexed<Z>;
|
|
2945
|
-
}
|
|
2946
3024
|
|
|
3025
|
+
[Symbol.iterator](): IterableIterator<T>;
|
|
3026
|
+
}
|
|
2947
3027
|
|
|
2948
3028
|
/**
|
|
2949
3029
|
* `Seq` which represents a set of values.
|
|
@@ -2951,8 +3031,7 @@ declare module Immutable {
|
|
|
2951
3031
|
* Because `Seq` are often lazy, `Seq.Set` does not provide the same guarantee
|
|
2952
3032
|
* of value uniqueness as the concrete `Set`.
|
|
2953
3033
|
*/
|
|
2954
|
-
|
|
2955
|
-
|
|
3034
|
+
namespace Set {
|
|
2956
3035
|
/**
|
|
2957
3036
|
* Returns a Seq.Set of the provided values
|
|
2958
3037
|
*/
|
|
@@ -2965,15 +3044,13 @@ declare module Immutable {
|
|
|
2965
3044
|
* Note: `Seq.Set` is a conversion function and not a class, and does not
|
|
2966
3045
|
* use the `new` keyword during construction.
|
|
2967
3046
|
*/
|
|
2968
|
-
|
|
2969
|
-
export function Set<T>(): Seq.Set<T>;
|
|
2970
|
-
export function Set<T>(collection: Iterable<T>): Seq.Set<T>;
|
|
3047
|
+
function Set<T>(collection: Iterable<T> | ArrayLike<T>): Seq.Set<T>;
|
|
2971
3048
|
|
|
2972
|
-
|
|
3049
|
+
interface Set<T> extends Seq<T, T>, Collection.Set<T> {
|
|
2973
3050
|
/**
|
|
2974
3051
|
* Deeply converts this Set Seq to equivalent native JavaScript Array.
|
|
2975
3052
|
*/
|
|
2976
|
-
toJS(): Array<
|
|
3053
|
+
toJS(): Array<unknown>;
|
|
2977
3054
|
|
|
2978
3055
|
/**
|
|
2979
3056
|
* Shallowly converts this Set Seq to equivalent native JavaScript Array.
|
|
@@ -2988,7 +3065,7 @@ declare module Immutable {
|
|
|
2988
3065
|
/**
|
|
2989
3066
|
* Returns itself
|
|
2990
3067
|
*/
|
|
2991
|
-
toSeq(): this
|
|
3068
|
+
toSeq(): this;
|
|
2992
3069
|
|
|
2993
3070
|
/**
|
|
2994
3071
|
* Returns a new Seq with other collections concatenated to this one.
|
|
@@ -3012,7 +3089,7 @@ declare module Immutable {
|
|
|
3012
3089
|
*/
|
|
3013
3090
|
map<M>(
|
|
3014
3091
|
mapper: (value: T, key: T, iter: this) => M,
|
|
3015
|
-
context?:
|
|
3092
|
+
context?: unknown
|
|
3016
3093
|
): Seq.Set<M>;
|
|
3017
3094
|
|
|
3018
3095
|
/**
|
|
@@ -3022,7 +3099,7 @@ declare module Immutable {
|
|
|
3022
3099
|
*/
|
|
3023
3100
|
flatMap<M>(
|
|
3024
3101
|
mapper: (value: T, key: T, iter: this) => Iterable<M>,
|
|
3025
|
-
context?:
|
|
3102
|
+
context?: unknown
|
|
3026
3103
|
): Seq.Set<M>;
|
|
3027
3104
|
|
|
3028
3105
|
/**
|
|
@@ -3034,14 +3111,15 @@ declare module Immutable {
|
|
|
3034
3111
|
*/
|
|
3035
3112
|
filter<F extends T>(
|
|
3036
3113
|
predicate: (value: T, key: T, iter: this) => value is F,
|
|
3037
|
-
context?:
|
|
3114
|
+
context?: unknown
|
|
3038
3115
|
): Seq.Set<F>;
|
|
3039
3116
|
filter(
|
|
3040
|
-
predicate: (value: T, key: T, iter: this) =>
|
|
3041
|
-
context?:
|
|
3117
|
+
predicate: (value: T, key: T, iter: this) => unknown,
|
|
3118
|
+
context?: unknown
|
|
3042
3119
|
): this;
|
|
3043
|
-
}
|
|
3044
3120
|
|
|
3121
|
+
[Symbol.iterator](): IterableIterator<T>;
|
|
3122
|
+
}
|
|
3045
3123
|
}
|
|
3046
3124
|
|
|
3047
3125
|
/**
|
|
@@ -3063,16 +3141,16 @@ declare module Immutable {
|
|
|
3063
3141
|
* Note: `Seq` is a conversion function and not a class, and does not use the
|
|
3064
3142
|
* `new` keyword during construction.
|
|
3065
3143
|
*/
|
|
3066
|
-
|
|
3067
|
-
|
|
3068
|
-
|
|
3069
|
-
|
|
3070
|
-
|
|
3071
|
-
|
|
3072
|
-
|
|
3073
|
-
|
|
3074
|
-
export interface Seq<K, V> extends Collection<K, V> {
|
|
3144
|
+
function Seq<S extends Seq<unknown, unknown>>(seq: S): S;
|
|
3145
|
+
function Seq<K, V>(collection: Collection.Keyed<K, V>): Seq.Keyed<K, V>;
|
|
3146
|
+
function Seq<T>(collection: Collection.Set<T>): Seq.Set<T>;
|
|
3147
|
+
function Seq<T>(
|
|
3148
|
+
collection: Collection.Indexed<T> | Iterable<T> | ArrayLike<T>
|
|
3149
|
+
): Seq.Indexed<T>;
|
|
3150
|
+
function Seq<V>(obj: { [key: string]: V }): Seq.Keyed<string, V>;
|
|
3151
|
+
function Seq(): Seq<unknown, unknown>;
|
|
3075
3152
|
|
|
3153
|
+
interface Seq<K, V> extends Collection<K, V> {
|
|
3076
3154
|
/**
|
|
3077
3155
|
* Some Seqs can describe their size lazily. When this is the case,
|
|
3078
3156
|
* size will be an integer. Otherwise it will be undefined.
|
|
@@ -3085,7 +3163,6 @@ declare module Immutable {
|
|
|
3085
3163
|
*/
|
|
3086
3164
|
readonly size: number | undefined;
|
|
3087
3165
|
|
|
3088
|
-
|
|
3089
3166
|
// Force evaluation
|
|
3090
3167
|
|
|
3091
3168
|
/**
|
|
@@ -3127,7 +3204,7 @@ declare module Immutable {
|
|
|
3127
3204
|
*/
|
|
3128
3205
|
map<M>(
|
|
3129
3206
|
mapper: (value: V, key: K, iter: this) => M,
|
|
3130
|
-
context?:
|
|
3207
|
+
context?: unknown
|
|
3131
3208
|
): Seq<K, M>;
|
|
3132
3209
|
|
|
3133
3210
|
/**
|
|
@@ -3146,7 +3223,7 @@ declare module Immutable {
|
|
|
3146
3223
|
*/
|
|
3147
3224
|
map<M>(
|
|
3148
3225
|
mapper: (value: V, key: K, iter: this) => M,
|
|
3149
|
-
context?:
|
|
3226
|
+
context?: unknown
|
|
3150
3227
|
): Seq<M, M>;
|
|
3151
3228
|
|
|
3152
3229
|
/**
|
|
@@ -3156,7 +3233,7 @@ declare module Immutable {
|
|
|
3156
3233
|
*/
|
|
3157
3234
|
flatMap<M>(
|
|
3158
3235
|
mapper: (value: V, key: K, iter: this) => Iterable<M>,
|
|
3159
|
-
context?:
|
|
3236
|
+
context?: unknown
|
|
3160
3237
|
): Seq<K, M>;
|
|
3161
3238
|
|
|
3162
3239
|
/**
|
|
@@ -3167,7 +3244,7 @@ declare module Immutable {
|
|
|
3167
3244
|
*/
|
|
3168
3245
|
flatMap<M>(
|
|
3169
3246
|
mapper: (value: V, key: K, iter: this) => Iterable<M>,
|
|
3170
|
-
context?:
|
|
3247
|
+
context?: unknown
|
|
3171
3248
|
): Seq<M, M>;
|
|
3172
3249
|
|
|
3173
3250
|
/**
|
|
@@ -3179,11 +3256,11 @@ declare module Immutable {
|
|
|
3179
3256
|
*/
|
|
3180
3257
|
filter<F extends V>(
|
|
3181
3258
|
predicate: (value: V, key: K, iter: this) => value is F,
|
|
3182
|
-
context?:
|
|
3259
|
+
context?: unknown
|
|
3183
3260
|
): Seq<K, F>;
|
|
3184
3261
|
filter(
|
|
3185
|
-
predicate: (value: V, key: K, iter: this) =>
|
|
3186
|
-
context?:
|
|
3262
|
+
predicate: (value: V, key: K, iter: this) => unknown,
|
|
3263
|
+
context?: unknown
|
|
3187
3264
|
): this;
|
|
3188
3265
|
}
|
|
3189
3266
|
|
|
@@ -3201,28 +3278,34 @@ declare module Immutable {
|
|
|
3201
3278
|
* Implementations should extend one of the subclasses, `Collection.Keyed`,
|
|
3202
3279
|
* `Collection.Indexed`, or `Collection.Set`.
|
|
3203
3280
|
*/
|
|
3204
|
-
|
|
3205
|
-
|
|
3281
|
+
namespace Collection {
|
|
3206
3282
|
/**
|
|
3207
3283
|
* @deprecated use `const { isKeyed } = require('immutable')`
|
|
3208
3284
|
*/
|
|
3209
|
-
function isKeyed(
|
|
3285
|
+
function isKeyed(
|
|
3286
|
+
maybeKeyed: unknown
|
|
3287
|
+
): maybeKeyed is Collection.Keyed<unknown, unknown>;
|
|
3210
3288
|
|
|
3211
3289
|
/**
|
|
3212
3290
|
* @deprecated use `const { isIndexed } = require('immutable')`
|
|
3213
3291
|
*/
|
|
3214
|
-
function isIndexed(
|
|
3292
|
+
function isIndexed(
|
|
3293
|
+
maybeIndexed: unknown
|
|
3294
|
+
): maybeIndexed is Collection.Indexed<unknown>;
|
|
3215
3295
|
|
|
3216
3296
|
/**
|
|
3217
3297
|
* @deprecated use `const { isAssociative } = require('immutable')`
|
|
3218
3298
|
*/
|
|
3219
|
-
function isAssociative(
|
|
3299
|
+
function isAssociative(
|
|
3300
|
+
maybeAssociative: unknown
|
|
3301
|
+
): maybeAssociative is
|
|
3302
|
+
| Collection.Keyed<unknown, unknown>
|
|
3303
|
+
| Collection.Indexed<unknown>;
|
|
3220
3304
|
|
|
3221
3305
|
/**
|
|
3222
3306
|
* @deprecated use `const { isOrdered } = require('immutable')`
|
|
3223
3307
|
*/
|
|
3224
|
-
function isOrdered(maybeOrdered:
|
|
3225
|
-
|
|
3308
|
+
function isOrdered(maybeOrdered: unknown): boolean;
|
|
3226
3309
|
|
|
3227
3310
|
/**
|
|
3228
3311
|
* Keyed Collections have discrete keys tied to each value.
|
|
@@ -3231,7 +3314,7 @@ declare module Immutable {
|
|
|
3231
3314
|
* tuple, in other words, `Collection#entries` is the default iterator for
|
|
3232
3315
|
* Keyed Collections.
|
|
3233
3316
|
*/
|
|
3234
|
-
|
|
3317
|
+
namespace Keyed {}
|
|
3235
3318
|
|
|
3236
3319
|
/**
|
|
3237
3320
|
* Creates a Collection.Keyed
|
|
@@ -3242,16 +3325,16 @@ declare module Immutable {
|
|
|
3242
3325
|
* Note: `Collection.Keyed` is a conversion function and not a class, and
|
|
3243
3326
|
* does not use the `new` keyword during construction.
|
|
3244
3327
|
*/
|
|
3245
|
-
|
|
3246
|
-
|
|
3328
|
+
function Keyed<K, V>(collection: Iterable<[K, V]>): Collection.Keyed<K, V>;
|
|
3329
|
+
function Keyed<V>(obj: { [key: string]: V }): Collection.Keyed<string, V>;
|
|
3247
3330
|
|
|
3248
|
-
|
|
3331
|
+
interface Keyed<K, V> extends Collection<K, V> {
|
|
3249
3332
|
/**
|
|
3250
3333
|
* Deeply converts this Keyed collection to equivalent native JavaScript Object.
|
|
3251
3334
|
*
|
|
3252
3335
|
* Converts keys to Strings.
|
|
3253
3336
|
*/
|
|
3254
|
-
toJS():
|
|
3337
|
+
toJS(): { [key: string]: unknown };
|
|
3255
3338
|
|
|
3256
3339
|
/**
|
|
3257
3340
|
* Shallowly converts this Keyed collection to equivalent native JavaScript Object.
|
|
@@ -3271,7 +3354,6 @@ declare module Immutable {
|
|
|
3271
3354
|
*/
|
|
3272
3355
|
toSeq(): Seq.Keyed<K, V>;
|
|
3273
3356
|
|
|
3274
|
-
|
|
3275
3357
|
// Sequence functions
|
|
3276
3358
|
|
|
3277
3359
|
/**
|
|
@@ -3290,8 +3372,12 @@ declare module Immutable {
|
|
|
3290
3372
|
/**
|
|
3291
3373
|
* Returns a new Collection with other collections concatenated to this one.
|
|
3292
3374
|
*/
|
|
3293
|
-
concat<KC, VC>(
|
|
3294
|
-
|
|
3375
|
+
concat<KC, VC>(
|
|
3376
|
+
...collections: Array<Iterable<[KC, VC]>>
|
|
3377
|
+
): Collection.Keyed<K | KC, V | VC>;
|
|
3378
|
+
concat<C>(
|
|
3379
|
+
...collections: Array<{ [key: string]: C }>
|
|
3380
|
+
): Collection.Keyed<K | string, V | C>;
|
|
3295
3381
|
|
|
3296
3382
|
/**
|
|
3297
3383
|
* Returns a new Collection.Keyed with values passed through a
|
|
@@ -3308,7 +3394,7 @@ declare module Immutable {
|
|
|
3308
3394
|
*/
|
|
3309
3395
|
map<M>(
|
|
3310
3396
|
mapper: (value: V, key: K, iter: this) => M,
|
|
3311
|
-
context?:
|
|
3397
|
+
context?: unknown
|
|
3312
3398
|
): Collection.Keyed<K, M>;
|
|
3313
3399
|
|
|
3314
3400
|
/**
|
|
@@ -3327,7 +3413,7 @@ declare module Immutable {
|
|
|
3327
3413
|
*/
|
|
3328
3414
|
mapKeys<M>(
|
|
3329
3415
|
mapper: (key: K, value: V, iter: this) => M,
|
|
3330
|
-
context?:
|
|
3416
|
+
context?: unknown
|
|
3331
3417
|
): Collection.Keyed<M, V>;
|
|
3332
3418
|
|
|
3333
3419
|
/**
|
|
@@ -3344,10 +3430,16 @@ declare module Immutable {
|
|
|
3344
3430
|
*
|
|
3345
3431
|
* Note: `mapEntries()` always returns a new instance, even if it produced
|
|
3346
3432
|
* the same entry at every step.
|
|
3433
|
+
*
|
|
3434
|
+
* If the mapper function returns `undefined`, then the entry will be filtered
|
|
3347
3435
|
*/
|
|
3348
3436
|
mapEntries<KM, VM>(
|
|
3349
|
-
mapper: (
|
|
3350
|
-
|
|
3437
|
+
mapper: (
|
|
3438
|
+
entry: [K, V],
|
|
3439
|
+
index: number,
|
|
3440
|
+
iter: this
|
|
3441
|
+
) => [KM, VM] | undefined,
|
|
3442
|
+
context?: unknown
|
|
3351
3443
|
): Collection.Keyed<KM, VM>;
|
|
3352
3444
|
|
|
3353
3445
|
/**
|
|
@@ -3357,7 +3449,7 @@ declare module Immutable {
|
|
|
3357
3449
|
*/
|
|
3358
3450
|
flatMap<KM, VM>(
|
|
3359
3451
|
mapper: (value: V, key: K, iter: this) => Iterable<[KM, VM]>,
|
|
3360
|
-
context?:
|
|
3452
|
+
context?: unknown
|
|
3361
3453
|
): Collection.Keyed<KM, VM>;
|
|
3362
3454
|
|
|
3363
3455
|
/**
|
|
@@ -3369,17 +3461,16 @@ declare module Immutable {
|
|
|
3369
3461
|
*/
|
|
3370
3462
|
filter<F extends V>(
|
|
3371
3463
|
predicate: (value: V, key: K, iter: this) => value is F,
|
|
3372
|
-
context?:
|
|
3464
|
+
context?: unknown
|
|
3373
3465
|
): Collection.Keyed<K, F>;
|
|
3374
3466
|
filter(
|
|
3375
|
-
predicate: (value: V, key: K, iter: this) =>
|
|
3376
|
-
context?:
|
|
3467
|
+
predicate: (value: V, key: K, iter: this) => unknown,
|
|
3468
|
+
context?: unknown
|
|
3377
3469
|
): this;
|
|
3378
3470
|
|
|
3379
3471
|
[Symbol.iterator](): IterableIterator<[K, V]>;
|
|
3380
3472
|
}
|
|
3381
3473
|
|
|
3382
|
-
|
|
3383
3474
|
/**
|
|
3384
3475
|
* Indexed Collections have incrementing numeric keys. They exhibit
|
|
3385
3476
|
* slightly different behavior than `Collection.Keyed` for some methods in order
|
|
@@ -3395,7 +3486,7 @@ declare module Immutable {
|
|
|
3395
3486
|
* preserve indices, using them as keys, convert to a Collection.Keyed by
|
|
3396
3487
|
* calling `toKeyedSeq`.
|
|
3397
3488
|
*/
|
|
3398
|
-
|
|
3489
|
+
namespace Indexed {}
|
|
3399
3490
|
|
|
3400
3491
|
/**
|
|
3401
3492
|
* Creates a new Collection.Indexed.
|
|
@@ -3403,13 +3494,15 @@ declare module Immutable {
|
|
|
3403
3494
|
* Note: `Collection.Indexed` is a conversion function and not a class, and
|
|
3404
3495
|
* does not use the `new` keyword during construction.
|
|
3405
3496
|
*/
|
|
3406
|
-
|
|
3497
|
+
function Indexed<T>(
|
|
3498
|
+
collection: Iterable<T> | ArrayLike<T>
|
|
3499
|
+
): Collection.Indexed<T>;
|
|
3407
3500
|
|
|
3408
|
-
|
|
3501
|
+
interface Indexed<T> extends Collection<number, T> {
|
|
3409
3502
|
/**
|
|
3410
3503
|
* Deeply converts this Indexed collection to equivalent native JavaScript Array.
|
|
3411
3504
|
*/
|
|
3412
|
-
toJS(): Array<
|
|
3505
|
+
toJS(): Array<unknown>;
|
|
3413
3506
|
|
|
3414
3507
|
/**
|
|
3415
3508
|
* Shallowly converts this Indexed collection to equivalent native JavaScript Array.
|
|
@@ -3433,7 +3526,6 @@ declare module Immutable {
|
|
|
3433
3526
|
get<NSV>(index: number, notSetValue: NSV): T | NSV;
|
|
3434
3527
|
get(index: number): T | undefined;
|
|
3435
3528
|
|
|
3436
|
-
|
|
3437
3529
|
// Conversion to Seq
|
|
3438
3530
|
|
|
3439
3531
|
/**
|
|
@@ -3446,8 +3538,7 @@ declare module Immutable {
|
|
|
3446
3538
|
* If this is a collection of [key, value] entry tuples, it will return a
|
|
3447
3539
|
* Seq.Keyed of those entries.
|
|
3448
3540
|
*/
|
|
3449
|
-
fromEntrySeq(): Seq.Keyed<
|
|
3450
|
-
|
|
3541
|
+
fromEntrySeq(): Seq.Keyed<unknown, unknown>;
|
|
3451
3542
|
|
|
3452
3543
|
// Combination
|
|
3453
3544
|
|
|
@@ -3470,7 +3561,7 @@ declare module Immutable {
|
|
|
3470
3561
|
* ```js
|
|
3471
3562
|
* const { List } = require('immutable')
|
|
3472
3563
|
* List([ 1, 2, 3 ]).interleave(List([ 'A', 'B', 'C' ]))
|
|
3473
|
-
* // List [ 1, "A", 2, "B", 3, "C"
|
|
3564
|
+
* // List [ 1, "A", 2, "B", 3, "C" ]
|
|
3474
3565
|
* ```
|
|
3475
3566
|
*
|
|
3476
3567
|
* The shortest Collection stops interleave.
|
|
@@ -3483,7 +3574,7 @@ declare module Immutable {
|
|
|
3483
3574
|
* List([ 'A', 'B' ]),
|
|
3484
3575
|
* List([ 'X', 'Y', 'Z' ])
|
|
3485
3576
|
* )
|
|
3486
|
-
* // List [ 1, "A", "X", 2, "B", "Y"
|
|
3577
|
+
* // List [ 1, "A", "X", 2, "B", "Y" ]
|
|
3487
3578
|
* ```
|
|
3488
3579
|
*
|
|
3489
3580
|
* Since `interleave()` re-indexes values, it produces a complete copy,
|
|
@@ -3491,7 +3582,7 @@ declare module Immutable {
|
|
|
3491
3582
|
*
|
|
3492
3583
|
* Note: `interleave` *cannot* be used in `withMutations`.
|
|
3493
3584
|
*/
|
|
3494
|
-
interleave(...collections: Array<Collection<
|
|
3585
|
+
interleave(...collections: Array<Collection<unknown, T>>): this;
|
|
3495
3586
|
|
|
3496
3587
|
/**
|
|
3497
3588
|
* Splice returns a new indexed Collection by replacing a region of this
|
|
@@ -3513,11 +3604,7 @@ declare module Immutable {
|
|
|
3513
3604
|
*
|
|
3514
3605
|
* Note: `splice` *cannot* be used in `withMutations`.
|
|
3515
3606
|
*/
|
|
3516
|
-
splice(
|
|
3517
|
-
index: number,
|
|
3518
|
-
removeNum: number,
|
|
3519
|
-
...values: Array<T>
|
|
3520
|
-
): this;
|
|
3607
|
+
splice(index: number, removeNum: number, ...values: Array<T>): this;
|
|
3521
3608
|
|
|
3522
3609
|
/**
|
|
3523
3610
|
* Returns a Collection of the same type "zipped" with the provided
|
|
@@ -3535,9 +3622,14 @@ declare module Immutable {
|
|
|
3535
3622
|
* const c = a.zip(b); // List [ [ 1, 4 ], [ 2, 5 ], [ 3, 6 ] ]
|
|
3536
3623
|
* ```
|
|
3537
3624
|
*/
|
|
3538
|
-
zip<U>(other: Collection<
|
|
3539
|
-
zip<U,V>(
|
|
3540
|
-
|
|
3625
|
+
zip<U>(other: Collection<unknown, U>): Collection.Indexed<[T, U]>;
|
|
3626
|
+
zip<U, V>(
|
|
3627
|
+
other: Collection<unknown, U>,
|
|
3628
|
+
other2: Collection<unknown, V>
|
|
3629
|
+
): Collection.Indexed<[T, U, V]>;
|
|
3630
|
+
zip(
|
|
3631
|
+
...collections: Array<Collection<unknown, unknown>>
|
|
3632
|
+
): Collection.Indexed<unknown>;
|
|
3541
3633
|
|
|
3542
3634
|
/**
|
|
3543
3635
|
* Returns a Collection "zipped" with the provided collections.
|
|
@@ -3551,9 +3643,14 @@ declare module Immutable {
|
|
|
3551
3643
|
* const c = a.zipAll(b); // List [ [ 1, 3 ], [ 2, 4 ], [ undefined, 5 ] ]
|
|
3552
3644
|
* ```
|
|
3553
3645
|
*/
|
|
3554
|
-
zipAll<U>(other: Collection<
|
|
3555
|
-
zipAll<U,V>(
|
|
3556
|
-
|
|
3646
|
+
zipAll<U>(other: Collection<unknown, U>): Collection.Indexed<[T, U]>;
|
|
3647
|
+
zipAll<U, V>(
|
|
3648
|
+
other: Collection<unknown, U>,
|
|
3649
|
+
other2: Collection<unknown, V>
|
|
3650
|
+
): Collection.Indexed<[T, U, V]>;
|
|
3651
|
+
zipAll(
|
|
3652
|
+
...collections: Array<Collection<unknown, unknown>>
|
|
3653
|
+
): Collection.Indexed<unknown>;
|
|
3557
3654
|
|
|
3558
3655
|
/**
|
|
3559
3656
|
* Returns a Collection of the same type "zipped" with the provided
|
|
@@ -3571,19 +3668,18 @@ declare module Immutable {
|
|
|
3571
3668
|
*/
|
|
3572
3669
|
zipWith<U, Z>(
|
|
3573
3670
|
zipper: (value: T, otherValue: U) => Z,
|
|
3574
|
-
otherCollection: Collection<
|
|
3671
|
+
otherCollection: Collection<unknown, U>
|
|
3575
3672
|
): Collection.Indexed<Z>;
|
|
3576
3673
|
zipWith<U, V, Z>(
|
|
3577
3674
|
zipper: (value: T, otherValue: U, thirdValue: V) => Z,
|
|
3578
|
-
otherCollection: Collection<
|
|
3579
|
-
thirdCollection: Collection<
|
|
3675
|
+
otherCollection: Collection<unknown, U>,
|
|
3676
|
+
thirdCollection: Collection<unknown, V>
|
|
3580
3677
|
): Collection.Indexed<Z>;
|
|
3581
3678
|
zipWith<Z>(
|
|
3582
|
-
zipper: (...
|
|
3583
|
-
...collections: Array<Collection<
|
|
3679
|
+
zipper: (...values: Array<unknown>) => Z,
|
|
3680
|
+
...collections: Array<Collection<unknown, unknown>>
|
|
3584
3681
|
): Collection.Indexed<Z>;
|
|
3585
3682
|
|
|
3586
|
-
|
|
3587
3683
|
// Search for value
|
|
3588
3684
|
|
|
3589
3685
|
/**
|
|
@@ -3604,7 +3700,7 @@ declare module Immutable {
|
|
|
3604
3700
|
*/
|
|
3605
3701
|
findIndex(
|
|
3606
3702
|
predicate: (value: T, index: number, iter: this) => boolean,
|
|
3607
|
-
context?:
|
|
3703
|
+
context?: unknown
|
|
3608
3704
|
): number;
|
|
3609
3705
|
|
|
3610
3706
|
/**
|
|
@@ -3613,7 +3709,7 @@ declare module Immutable {
|
|
|
3613
3709
|
*/
|
|
3614
3710
|
findLastIndex(
|
|
3615
3711
|
predicate: (value: T, index: number, iter: this) => boolean,
|
|
3616
|
-
context?:
|
|
3712
|
+
context?: unknown
|
|
3617
3713
|
): number;
|
|
3618
3714
|
|
|
3619
3715
|
// Sequence algorithms
|
|
@@ -3621,7 +3717,9 @@ declare module Immutable {
|
|
|
3621
3717
|
/**
|
|
3622
3718
|
* Returns a new Collection with other collections concatenated to this one.
|
|
3623
3719
|
*/
|
|
3624
|
-
concat<C>(
|
|
3720
|
+
concat<C>(
|
|
3721
|
+
...valuesOrCollections: Array<Iterable<C> | C>
|
|
3722
|
+
): Collection.Indexed<T | C>;
|
|
3625
3723
|
|
|
3626
3724
|
/**
|
|
3627
3725
|
* Returns a new Collection.Indexed with values passed through a
|
|
@@ -3638,7 +3736,7 @@ declare module Immutable {
|
|
|
3638
3736
|
*/
|
|
3639
3737
|
map<M>(
|
|
3640
3738
|
mapper: (value: T, key: number, iter: this) => M,
|
|
3641
|
-
context?:
|
|
3739
|
+
context?: unknown
|
|
3642
3740
|
): Collection.Indexed<M>;
|
|
3643
3741
|
|
|
3644
3742
|
/**
|
|
@@ -3648,7 +3746,7 @@ declare module Immutable {
|
|
|
3648
3746
|
*/
|
|
3649
3747
|
flatMap<M>(
|
|
3650
3748
|
mapper: (value: T, key: number, iter: this) => Iterable<M>,
|
|
3651
|
-
context?:
|
|
3749
|
+
context?: unknown
|
|
3652
3750
|
): Collection.Indexed<M>;
|
|
3653
3751
|
|
|
3654
3752
|
/**
|
|
@@ -3660,17 +3758,16 @@ declare module Immutable {
|
|
|
3660
3758
|
*/
|
|
3661
3759
|
filter<F extends T>(
|
|
3662
3760
|
predicate: (value: T, index: number, iter: this) => value is F,
|
|
3663
|
-
context?:
|
|
3761
|
+
context?: unknown
|
|
3664
3762
|
): Collection.Indexed<F>;
|
|
3665
3763
|
filter(
|
|
3666
|
-
predicate: (value: T, index: number, iter: this) =>
|
|
3667
|
-
context?:
|
|
3764
|
+
predicate: (value: T, index: number, iter: this) => unknown,
|
|
3765
|
+
context?: unknown
|
|
3668
3766
|
): this;
|
|
3669
3767
|
|
|
3670
3768
|
[Symbol.iterator](): IterableIterator<T>;
|
|
3671
3769
|
}
|
|
3672
3770
|
|
|
3673
|
-
|
|
3674
3771
|
/**
|
|
3675
3772
|
* Set Collections only represent values. They have no associated keys or
|
|
3676
3773
|
* indices. Duplicate values are possible in the lazy `Seq.Set`s, however
|
|
@@ -3688,7 +3785,7 @@ declare module Immutable {
|
|
|
3688
3785
|
* )
|
|
3689
3786
|
* ```
|
|
3690
3787
|
*/
|
|
3691
|
-
|
|
3788
|
+
namespace Set {}
|
|
3692
3789
|
|
|
3693
3790
|
/**
|
|
3694
3791
|
* Similar to `Collection()`, but always returns a Collection.Set.
|
|
@@ -3696,13 +3793,13 @@ declare module Immutable {
|
|
|
3696
3793
|
* Note: `Collection.Set` is a factory function and not a class, and does
|
|
3697
3794
|
* not use the `new` keyword during construction.
|
|
3698
3795
|
*/
|
|
3699
|
-
|
|
3796
|
+
function Set<T>(collection: Iterable<T> | ArrayLike<T>): Collection.Set<T>;
|
|
3700
3797
|
|
|
3701
|
-
|
|
3798
|
+
interface Set<T> extends Collection<T, T> {
|
|
3702
3799
|
/**
|
|
3703
3800
|
* Deeply converts this Set collection to equivalent native JavaScript Array.
|
|
3704
3801
|
*/
|
|
3705
|
-
toJS(): Array<
|
|
3802
|
+
toJS(): Array<unknown>;
|
|
3706
3803
|
|
|
3707
3804
|
/**
|
|
3708
3805
|
* Shallowly converts this Set collection to equivalent native JavaScript Array.
|
|
@@ -3741,7 +3838,7 @@ declare module Immutable {
|
|
|
3741
3838
|
*/
|
|
3742
3839
|
map<M>(
|
|
3743
3840
|
mapper: (value: T, key: T, iter: this) => M,
|
|
3744
|
-
context?:
|
|
3841
|
+
context?: unknown
|
|
3745
3842
|
): Collection.Set<M>;
|
|
3746
3843
|
|
|
3747
3844
|
/**
|
|
@@ -3751,7 +3848,7 @@ declare module Immutable {
|
|
|
3751
3848
|
*/
|
|
3752
3849
|
flatMap<M>(
|
|
3753
3850
|
mapper: (value: T, key: T, iter: this) => Iterable<M>,
|
|
3754
|
-
context?:
|
|
3851
|
+
context?: unknown
|
|
3755
3852
|
): Collection.Set<M>;
|
|
3756
3853
|
|
|
3757
3854
|
/**
|
|
@@ -3763,16 +3860,15 @@ declare module Immutable {
|
|
|
3763
3860
|
*/
|
|
3764
3861
|
filter<F extends T>(
|
|
3765
3862
|
predicate: (value: T, key: T, iter: this) => value is F,
|
|
3766
|
-
context?:
|
|
3863
|
+
context?: unknown
|
|
3767
3864
|
): Collection.Set<F>;
|
|
3768
3865
|
filter(
|
|
3769
|
-
predicate: (value: T, key: T, iter: this) =>
|
|
3770
|
-
context?:
|
|
3866
|
+
predicate: (value: T, key: T, iter: this) => unknown,
|
|
3867
|
+
context?: unknown
|
|
3771
3868
|
): this;
|
|
3772
3869
|
|
|
3773
3870
|
[Symbol.iterator](): IterableIterator<T>;
|
|
3774
3871
|
}
|
|
3775
|
-
|
|
3776
3872
|
}
|
|
3777
3873
|
|
|
3778
3874
|
/**
|
|
@@ -3797,12 +3893,15 @@ declare module Immutable {
|
|
|
3797
3893
|
* Note: `Collection` is a conversion function and not a class, and does not
|
|
3798
3894
|
* use the `new` keyword during construction.
|
|
3799
3895
|
*/
|
|
3800
|
-
|
|
3801
|
-
|
|
3802
|
-
|
|
3803
|
-
|
|
3804
|
-
|
|
3805
|
-
|
|
3896
|
+
function Collection<I extends Collection<unknown, unknown>>(collection: I): I;
|
|
3897
|
+
function Collection<T>(
|
|
3898
|
+
collection: Iterable<T> | ArrayLike<T>
|
|
3899
|
+
): Collection.Indexed<T>;
|
|
3900
|
+
function Collection<V>(obj: {
|
|
3901
|
+
[key: string]: V;
|
|
3902
|
+
}): Collection.Keyed<string, V>;
|
|
3903
|
+
|
|
3904
|
+
interface Collection<K, V> extends ValueObject {
|
|
3806
3905
|
// Value equality
|
|
3807
3906
|
|
|
3808
3907
|
/**
|
|
@@ -3812,7 +3911,7 @@ declare module Immutable {
|
|
|
3812
3911
|
* Note: This is equivalent to `Immutable.is(this, other)`, but provided to
|
|
3813
3912
|
* allow for chained expressions.
|
|
3814
3913
|
*/
|
|
3815
|
-
equals(other:
|
|
3914
|
+
equals(other: unknown): boolean;
|
|
3816
3915
|
|
|
3817
3916
|
/**
|
|
3818
3917
|
* Computes and returns the hashed identity for this Collection.
|
|
@@ -3836,11 +3935,10 @@ declare module Immutable {
|
|
|
3836
3935
|
* to be equal][Hash Collision]. If two values have different `hashCode`s,
|
|
3837
3936
|
* they must not be equal.
|
|
3838
3937
|
*
|
|
3839
|
-
* [Hash Collision]:
|
|
3938
|
+
* [Hash Collision]: https://en.wikipedia.org/wiki/Collision_(computer_science)
|
|
3840
3939
|
*/
|
|
3841
3940
|
hashCode(): number;
|
|
3842
3941
|
|
|
3843
|
-
|
|
3844
3942
|
// Reading values
|
|
3845
3943
|
|
|
3846
3944
|
/**
|
|
@@ -3874,7 +3972,7 @@ declare module Immutable {
|
|
|
3874
3972
|
* In case the `Collection` is empty returns the optional default
|
|
3875
3973
|
* value if provided, if no default value is provided returns undefined.
|
|
3876
3974
|
*/
|
|
3877
|
-
first<NSV>(notSetValue?: NSV): V | NSV;
|
|
3975
|
+
first<NSV = undefined>(notSetValue?: NSV): V | NSV;
|
|
3878
3976
|
|
|
3879
3977
|
/**
|
|
3880
3978
|
* In case the `Collection` is not empty returns the last element of the
|
|
@@ -3882,7 +3980,7 @@ declare module Immutable {
|
|
|
3882
3980
|
* In case the `Collection` is empty returns the optional default
|
|
3883
3981
|
* value if provided, if no default value is provided returns undefined.
|
|
3884
3982
|
*/
|
|
3885
|
-
last<NSV>(notSetValue?: NSV): V | NSV;
|
|
3983
|
+
last<NSV = undefined>(notSetValue?: NSV): V | NSV;
|
|
3886
3984
|
|
|
3887
3985
|
// Reading deep values
|
|
3888
3986
|
|
|
@@ -3907,13 +4005,13 @@ declare module Immutable {
|
|
|
3907
4005
|
* deepData.getIn(['x', 0, 'y']) // 123
|
|
3908
4006
|
* ```
|
|
3909
4007
|
*/
|
|
3910
|
-
getIn(searchKeyPath: Iterable<
|
|
4008
|
+
getIn(searchKeyPath: Iterable<unknown>, notSetValue?: unknown): unknown;
|
|
3911
4009
|
|
|
3912
4010
|
/**
|
|
3913
4011
|
* True if the result of following a path of keys or indices through nested
|
|
3914
4012
|
* Collections results in a set value.
|
|
3915
4013
|
*/
|
|
3916
|
-
hasIn(searchKeyPath: Iterable<
|
|
4014
|
+
hasIn(searchKeyPath: Iterable<unknown>): boolean;
|
|
3917
4015
|
|
|
3918
4016
|
// Persistent changes
|
|
3919
4017
|
|
|
@@ -3940,7 +4038,6 @@ declare module Immutable {
|
|
|
3940
4038
|
*/
|
|
3941
4039
|
update<R>(updater: (value: this) => R): R;
|
|
3942
4040
|
|
|
3943
|
-
|
|
3944
4041
|
// Conversion to JavaScript types
|
|
3945
4042
|
|
|
3946
4043
|
/**
|
|
@@ -3949,7 +4046,7 @@ declare module Immutable {
|
|
|
3949
4046
|
* `Collection.Indexed`, and `Collection.Set` become `Array`, while
|
|
3950
4047
|
* `Collection.Keyed` become `Object`, converting keys to Strings.
|
|
3951
4048
|
*/
|
|
3952
|
-
toJS(): Array<
|
|
4049
|
+
toJS(): Array<unknown> | { [key: string]: unknown };
|
|
3953
4050
|
|
|
3954
4051
|
/**
|
|
3955
4052
|
* Shallowly converts this Collection to equivalent native JavaScript Array or Object.
|
|
@@ -3974,7 +4071,6 @@ declare module Immutable {
|
|
|
3974
4071
|
*/
|
|
3975
4072
|
toObject(): { [key: string]: V };
|
|
3976
4073
|
|
|
3977
|
-
|
|
3978
4074
|
// Conversion to Collections
|
|
3979
4075
|
|
|
3980
4076
|
/**
|
|
@@ -4038,7 +4134,6 @@ declare module Immutable {
|
|
|
4038
4134
|
*/
|
|
4039
4135
|
toStack(): Stack<V>;
|
|
4040
4136
|
|
|
4041
|
-
|
|
4042
4137
|
// Conversion to Seq
|
|
4043
4138
|
|
|
4044
4139
|
/**
|
|
@@ -4081,7 +4176,6 @@ declare module Immutable {
|
|
|
4081
4176
|
*/
|
|
4082
4177
|
toSetSeq(): Seq.Set<V>;
|
|
4083
4178
|
|
|
4084
|
-
|
|
4085
4179
|
// Iterators
|
|
4086
4180
|
|
|
4087
4181
|
/**
|
|
@@ -4111,6 +4205,7 @@ declare module Immutable {
|
|
|
4111
4205
|
*/
|
|
4112
4206
|
entries(): IterableIterator<[K, V]>;
|
|
4113
4207
|
|
|
4208
|
+
[Symbol.iterator](): IterableIterator<unknown>;
|
|
4114
4209
|
|
|
4115
4210
|
// Collections (Seq)
|
|
4116
4211
|
|
|
@@ -4130,7 +4225,6 @@ declare module Immutable {
|
|
|
4130
4225
|
*/
|
|
4131
4226
|
entrySeq(): Seq.Indexed<[K, V]>;
|
|
4132
4227
|
|
|
4133
|
-
|
|
4134
4228
|
// Sequence algorithms
|
|
4135
4229
|
|
|
4136
4230
|
/**
|
|
@@ -4149,7 +4243,7 @@ declare module Immutable {
|
|
|
4149
4243
|
*/
|
|
4150
4244
|
map<M>(
|
|
4151
4245
|
mapper: (value: V, key: K, iter: this) => M,
|
|
4152
|
-
context?:
|
|
4246
|
+
context?: unknown
|
|
4153
4247
|
): Collection<K, M>;
|
|
4154
4248
|
|
|
4155
4249
|
/**
|
|
@@ -4158,7 +4252,7 @@ declare module Immutable {
|
|
|
4158
4252
|
*
|
|
4159
4253
|
* @ignore
|
|
4160
4254
|
*/
|
|
4161
|
-
map
|
|
4255
|
+
map(...args: Array<never>): unknown;
|
|
4162
4256
|
|
|
4163
4257
|
/**
|
|
4164
4258
|
* Returns a new Collection of the same type with only the entries for which
|
|
@@ -4176,11 +4270,11 @@ declare module Immutable {
|
|
|
4176
4270
|
*/
|
|
4177
4271
|
filter<F extends V>(
|
|
4178
4272
|
predicate: (value: V, key: K, iter: this) => value is F,
|
|
4179
|
-
context?:
|
|
4273
|
+
context?: unknown
|
|
4180
4274
|
): Collection<K, F>;
|
|
4181
4275
|
filter(
|
|
4182
|
-
predicate: (value: V, key: K, iter: this) =>
|
|
4183
|
-
context?:
|
|
4276
|
+
predicate: (value: V, key: K, iter: this) => unknown,
|
|
4277
|
+
context?: unknown
|
|
4184
4278
|
): this;
|
|
4185
4279
|
|
|
4186
4280
|
/**
|
|
@@ -4199,7 +4293,7 @@ declare module Immutable {
|
|
|
4199
4293
|
*/
|
|
4200
4294
|
filterNot(
|
|
4201
4295
|
predicate: (value: V, key: K, iter: this) => boolean,
|
|
4202
|
-
context?:
|
|
4296
|
+
context?: unknown
|
|
4203
4297
|
): this;
|
|
4204
4298
|
|
|
4205
4299
|
/**
|
|
@@ -4246,7 +4340,17 @@ declare module Immutable {
|
|
|
4246
4340
|
* Like `sort`, but also accepts a `comparatorValueMapper` which allows for
|
|
4247
4341
|
* sorting by more sophisticated means:
|
|
4248
4342
|
*
|
|
4249
|
-
*
|
|
4343
|
+
* <!-- runkit:activate -->
|
|
4344
|
+
* ```js
|
|
4345
|
+
* const { Map } = require('immutable')
|
|
4346
|
+
* const beattles = Map({
|
|
4347
|
+
* John: { name: "Lennon" },
|
|
4348
|
+
* Paul: { name: "McCartney" },
|
|
4349
|
+
* George: { name: "Harrison" },
|
|
4350
|
+
* Ringo: { name: "Starr" },
|
|
4351
|
+
* });
|
|
4352
|
+
* beattles.sortBy(member => member.name);
|
|
4353
|
+
* ```
|
|
4250
4354
|
*
|
|
4251
4355
|
* Note: `sortBy()` Always returns a new instance, even if the original was
|
|
4252
4356
|
* already sorted.
|
|
@@ -4284,9 +4388,8 @@ declare module Immutable {
|
|
|
4284
4388
|
*/
|
|
4285
4389
|
groupBy<G>(
|
|
4286
4390
|
grouper: (value: V, key: K, iter: this) => G,
|
|
4287
|
-
context?:
|
|
4288
|
-
): /*Map*/Seq.Keyed<G, /*this*/Collection<K, V>>;
|
|
4289
|
-
|
|
4391
|
+
context?: unknown
|
|
4392
|
+
): /*Map*/ Seq.Keyed<G, /*this*/ Collection<K, V>>;
|
|
4290
4393
|
|
|
4291
4394
|
// Side effects
|
|
4292
4395
|
|
|
@@ -4298,11 +4401,10 @@ declare module Immutable {
|
|
|
4298
4401
|
* (including the last iteration which returned false).
|
|
4299
4402
|
*/
|
|
4300
4403
|
forEach(
|
|
4301
|
-
sideEffect: (value: V, key: K, iter: this) =>
|
|
4302
|
-
context?:
|
|
4404
|
+
sideEffect: (value: V, key: K, iter: this) => unknown,
|
|
4405
|
+
context?: unknown
|
|
4303
4406
|
): number;
|
|
4304
4407
|
|
|
4305
|
-
|
|
4306
4408
|
// Creating subsets
|
|
4307
4409
|
|
|
4308
4410
|
/**
|
|
@@ -4356,12 +4458,12 @@ declare module Immutable {
|
|
|
4356
4458
|
* const { List } = require('immutable')
|
|
4357
4459
|
* List([ 'dog', 'frog', 'cat', 'hat', 'god' ])
|
|
4358
4460
|
* .skipWhile(x => x.match(/g/))
|
|
4359
|
-
* // List [ "cat", "hat", "god"
|
|
4461
|
+
* // List [ "cat", "hat", "god" ]
|
|
4360
4462
|
* ```
|
|
4361
4463
|
*/
|
|
4362
4464
|
skipWhile(
|
|
4363
4465
|
predicate: (value: V, key: K, iter: this) => boolean,
|
|
4364
|
-
context?:
|
|
4466
|
+
context?: unknown
|
|
4365
4467
|
): this;
|
|
4366
4468
|
|
|
4367
4469
|
/**
|
|
@@ -4373,12 +4475,12 @@ declare module Immutable {
|
|
|
4373
4475
|
* const { List } = require('immutable')
|
|
4374
4476
|
* List([ 'dog', 'frog', 'cat', 'hat', 'god' ])
|
|
4375
4477
|
* .skipUntil(x => x.match(/hat/))
|
|
4376
|
-
* // List [ "hat", "god"
|
|
4478
|
+
* // List [ "hat", "god" ]
|
|
4377
4479
|
* ```
|
|
4378
4480
|
*/
|
|
4379
4481
|
skipUntil(
|
|
4380
4482
|
predicate: (value: V, key: K, iter: this) => boolean,
|
|
4381
|
-
context?:
|
|
4483
|
+
context?: unknown
|
|
4382
4484
|
): this;
|
|
4383
4485
|
|
|
4384
4486
|
/**
|
|
@@ -4407,7 +4509,7 @@ declare module Immutable {
|
|
|
4407
4509
|
*/
|
|
4408
4510
|
takeWhile(
|
|
4409
4511
|
predicate: (value: V, key: K, iter: this) => boolean,
|
|
4410
|
-
context?:
|
|
4512
|
+
context?: unknown
|
|
4411
4513
|
): this;
|
|
4412
4514
|
|
|
4413
4515
|
/**
|
|
@@ -4424,10 +4526,9 @@ declare module Immutable {
|
|
|
4424
4526
|
*/
|
|
4425
4527
|
takeUntil(
|
|
4426
4528
|
predicate: (value: V, key: K, iter: this) => boolean,
|
|
4427
|
-
context?:
|
|
4529
|
+
context?: unknown
|
|
4428
4530
|
): this;
|
|
4429
4531
|
|
|
4430
|
-
|
|
4431
4532
|
// Combination
|
|
4432
4533
|
|
|
4433
4534
|
/**
|
|
@@ -4437,7 +4538,9 @@ declare module Immutable {
|
|
|
4437
4538
|
* For Seqs, all entries will be present in the resulting Seq, even if they
|
|
4438
4539
|
* have the same key.
|
|
4439
4540
|
*/
|
|
4440
|
-
concat(
|
|
4541
|
+
concat(
|
|
4542
|
+
...valuesOrCollections: Array<unknown>
|
|
4543
|
+
): Collection<unknown, unknown>;
|
|
4441
4544
|
|
|
4442
4545
|
/**
|
|
4443
4546
|
* Flattens nested Collections.
|
|
@@ -4449,11 +4552,12 @@ declare module Immutable {
|
|
|
4449
4552
|
*
|
|
4450
4553
|
* Flattens only others Collection, not Arrays or Objects.
|
|
4451
4554
|
*
|
|
4452
|
-
* Note: `flatten(true)` operates on Collection<
|
|
4555
|
+
* Note: `flatten(true)` operates on Collection<unknown, Collection<K, V>> and
|
|
4453
4556
|
* returns Collection<K, V>
|
|
4454
4557
|
*/
|
|
4455
|
-
flatten(depth?: number): Collection<
|
|
4456
|
-
|
|
4558
|
+
flatten(depth?: number): Collection<unknown, unknown>;
|
|
4559
|
+
// tslint:disable-next-line unified-signatures
|
|
4560
|
+
flatten(shallow?: boolean): Collection<unknown, unknown>;
|
|
4457
4561
|
|
|
4458
4562
|
/**
|
|
4459
4563
|
* Flat-maps the Collection, returning a Collection of the same type.
|
|
@@ -4462,7 +4566,7 @@ declare module Immutable {
|
|
|
4462
4566
|
*/
|
|
4463
4567
|
flatMap<M>(
|
|
4464
4568
|
mapper: (value: V, key: K, iter: this) => Iterable<M>,
|
|
4465
|
-
context?:
|
|
4569
|
+
context?: unknown
|
|
4466
4570
|
): Collection<K, M>;
|
|
4467
4571
|
|
|
4468
4572
|
/**
|
|
@@ -4473,7 +4577,7 @@ declare module Immutable {
|
|
|
4473
4577
|
*/
|
|
4474
4578
|
flatMap<KM, VM>(
|
|
4475
4579
|
mapper: (value: V, key: K, iter: this) => Iterable<[KM, VM]>,
|
|
4476
|
-
context?:
|
|
4580
|
+
context?: unknown
|
|
4477
4581
|
): Collection<KM, VM>;
|
|
4478
4582
|
|
|
4479
4583
|
// Reducing a value
|
|
@@ -4490,7 +4594,7 @@ declare module Immutable {
|
|
|
4490
4594
|
reduce<R>(
|
|
4491
4595
|
reducer: (reduction: R, value: V, key: K, iter: this) => R,
|
|
4492
4596
|
initialReduction: R,
|
|
4493
|
-
context?:
|
|
4597
|
+
context?: unknown
|
|
4494
4598
|
): R;
|
|
4495
4599
|
reduce<R>(
|
|
4496
4600
|
reducer: (reduction: V | R, value: V, key: K, iter: this) => R
|
|
@@ -4505,7 +4609,7 @@ declare module Immutable {
|
|
|
4505
4609
|
reduceRight<R>(
|
|
4506
4610
|
reducer: (reduction: R, value: V, key: K, iter: this) => R,
|
|
4507
4611
|
initialReduction: R,
|
|
4508
|
-
context?:
|
|
4612
|
+
context?: unknown
|
|
4509
4613
|
): R;
|
|
4510
4614
|
reduceRight<R>(
|
|
4511
4615
|
reducer: (reduction: V | R, value: V, key: K, iter: this) => R
|
|
@@ -4516,7 +4620,7 @@ declare module Immutable {
|
|
|
4516
4620
|
*/
|
|
4517
4621
|
every(
|
|
4518
4622
|
predicate: (value: V, key: K, iter: this) => boolean,
|
|
4519
|
-
context?:
|
|
4623
|
+
context?: unknown
|
|
4520
4624
|
): boolean;
|
|
4521
4625
|
|
|
4522
4626
|
/**
|
|
@@ -4524,7 +4628,7 @@ declare module Immutable {
|
|
|
4524
4628
|
*/
|
|
4525
4629
|
some(
|
|
4526
4630
|
predicate: (value: V, key: K, iter: this) => boolean,
|
|
4527
|
-
context?:
|
|
4631
|
+
context?: unknown
|
|
4528
4632
|
): boolean;
|
|
4529
4633
|
|
|
4530
4634
|
/**
|
|
@@ -4554,7 +4658,7 @@ declare module Immutable {
|
|
|
4554
4658
|
count(): number;
|
|
4555
4659
|
count(
|
|
4556
4660
|
predicate: (value: V, key: K, iter: this) => boolean,
|
|
4557
|
-
context?:
|
|
4661
|
+
context?: unknown
|
|
4558
4662
|
): number;
|
|
4559
4663
|
|
|
4560
4664
|
/**
|
|
@@ -4565,10 +4669,9 @@ declare module Immutable {
|
|
|
4565
4669
|
*/
|
|
4566
4670
|
countBy<G>(
|
|
4567
4671
|
grouper: (value: V, key: K, iter: this) => G,
|
|
4568
|
-
context?:
|
|
4672
|
+
context?: unknown
|
|
4569
4673
|
): Map<G, number>;
|
|
4570
4674
|
|
|
4571
|
-
|
|
4572
4675
|
// Search for value
|
|
4573
4676
|
|
|
4574
4677
|
/**
|
|
@@ -4576,7 +4679,7 @@ declare module Immutable {
|
|
|
4576
4679
|
*/
|
|
4577
4680
|
find(
|
|
4578
4681
|
predicate: (value: V, key: K, iter: this) => boolean,
|
|
4579
|
-
context?:
|
|
4682
|
+
context?: unknown,
|
|
4580
4683
|
notSetValue?: V
|
|
4581
4684
|
): V | undefined;
|
|
4582
4685
|
|
|
@@ -4587,7 +4690,7 @@ declare module Immutable {
|
|
|
4587
4690
|
*/
|
|
4588
4691
|
findLast(
|
|
4589
4692
|
predicate: (value: V, key: K, iter: this) => boolean,
|
|
4590
|
-
context?:
|
|
4693
|
+
context?: unknown,
|
|
4591
4694
|
notSetValue?: V
|
|
4592
4695
|
): V | undefined;
|
|
4593
4696
|
|
|
@@ -4596,7 +4699,7 @@ declare module Immutable {
|
|
|
4596
4699
|
*/
|
|
4597
4700
|
findEntry(
|
|
4598
4701
|
predicate: (value: V, key: K, iter: this) => boolean,
|
|
4599
|
-
context?:
|
|
4702
|
+
context?: unknown,
|
|
4600
4703
|
notSetValue?: V
|
|
4601
4704
|
): [K, V] | undefined;
|
|
4602
4705
|
|
|
@@ -4608,7 +4711,7 @@ declare module Immutable {
|
|
|
4608
4711
|
*/
|
|
4609
4712
|
findLastEntry(
|
|
4610
4713
|
predicate: (value: V, key: K, iter: this) => boolean,
|
|
4611
|
-
context?:
|
|
4714
|
+
context?: unknown,
|
|
4612
4715
|
notSetValue?: V
|
|
4613
4716
|
): [K, V] | undefined;
|
|
4614
4717
|
|
|
@@ -4617,7 +4720,7 @@ declare module Immutable {
|
|
|
4617
4720
|
*/
|
|
4618
4721
|
findKey(
|
|
4619
4722
|
predicate: (value: V, key: K, iter: this) => boolean,
|
|
4620
|
-
context?:
|
|
4723
|
+
context?: unknown
|
|
4621
4724
|
): K | undefined;
|
|
4622
4725
|
|
|
4623
4726
|
/**
|
|
@@ -4627,7 +4730,7 @@ declare module Immutable {
|
|
|
4627
4730
|
*/
|
|
4628
4731
|
findLastKey(
|
|
4629
4732
|
predicate: (value: V, key: K, iter: this) => boolean,
|
|
4630
|
-
context?:
|
|
4733
|
+
context?: unknown
|
|
4631
4734
|
): K | undefined;
|
|
4632
4735
|
|
|
4633
4736
|
/**
|
|
@@ -4661,8 +4764,16 @@ declare module Immutable {
|
|
|
4661
4764
|
* Like `max`, but also accepts a `comparatorValueMapper` which allows for
|
|
4662
4765
|
* comparing by more sophisticated means:
|
|
4663
4766
|
*
|
|
4664
|
-
*
|
|
4665
|
-
*
|
|
4767
|
+
* <!-- runkit:activate -->
|
|
4768
|
+
* ```js
|
|
4769
|
+
* const { List, } = require('immutable');
|
|
4770
|
+
* const l = List([
|
|
4771
|
+
* { name: 'Bob', avgHit: 1 },
|
|
4772
|
+
* { name: 'Max', avgHit: 3 },
|
|
4773
|
+
* { name: 'Lili', avgHit: 2 } ,
|
|
4774
|
+
* ]);
|
|
4775
|
+
* l.maxBy(i => i.avgHit); // will output { name: 'Max', avgHit: 3 }
|
|
4776
|
+
* ```
|
|
4666
4777
|
*/
|
|
4667
4778
|
maxBy<C>(
|
|
4668
4779
|
comparatorValueMapper: (value: V, key: K, iter: this) => C,
|
|
@@ -4690,15 +4801,22 @@ declare module Immutable {
|
|
|
4690
4801
|
* Like `min`, but also accepts a `comparatorValueMapper` which allows for
|
|
4691
4802
|
* comparing by more sophisticated means:
|
|
4692
4803
|
*
|
|
4693
|
-
*
|
|
4694
|
-
*
|
|
4804
|
+
* <!-- runkit:activate -->
|
|
4805
|
+
* ```js
|
|
4806
|
+
* const { List, } = require('immutable');
|
|
4807
|
+
* const l = List([
|
|
4808
|
+
* { name: 'Bob', avgHit: 1 },
|
|
4809
|
+
* { name: 'Max', avgHit: 3 },
|
|
4810
|
+
* { name: 'Lili', avgHit: 2 } ,
|
|
4811
|
+
* ]);
|
|
4812
|
+
* l.minBy(i => i.avgHit); // will output { name: 'Bob', avgHit: 1 }
|
|
4813
|
+
* ```
|
|
4695
4814
|
*/
|
|
4696
4815
|
minBy<C>(
|
|
4697
4816
|
comparatorValueMapper: (value: V, key: K, iter: this) => C,
|
|
4698
4817
|
comparator?: (valueA: C, valueB: C) => number
|
|
4699
4818
|
): V | undefined;
|
|
4700
4819
|
|
|
4701
|
-
|
|
4702
4820
|
// Comparison
|
|
4703
4821
|
|
|
4704
4822
|
/**
|
|
@@ -4715,7 +4833,7 @@ declare module Immutable {
|
|
|
4715
4833
|
/**
|
|
4716
4834
|
* The interface to fulfill to qualify as a Value Object.
|
|
4717
4835
|
*/
|
|
4718
|
-
|
|
4836
|
+
interface ValueObject {
|
|
4719
4837
|
/**
|
|
4720
4838
|
* True if this and the other Collection have value equality, as defined
|
|
4721
4839
|
* by `Immutable.is()`.
|
|
@@ -4723,7 +4841,7 @@ declare module Immutable {
|
|
|
4723
4841
|
* Note: This is equivalent to `Immutable.is(this, other)`, but provided to
|
|
4724
4842
|
* allow for chained expressions.
|
|
4725
4843
|
*/
|
|
4726
|
-
equals(other:
|
|
4844
|
+
equals(other: unknown): boolean;
|
|
4727
4845
|
|
|
4728
4846
|
/**
|
|
4729
4847
|
* Computes and returns the hashed identity for this Collection.
|
|
@@ -4754,7 +4872,7 @@ declare module Immutable {
|
|
|
4754
4872
|
* organize their internal data structures, while all Immutable.js
|
|
4755
4873
|
* collections use equality during lookups.
|
|
4756
4874
|
*
|
|
4757
|
-
* [Hash Collision]:
|
|
4875
|
+
* [Hash Collision]: https://en.wikipedia.org/wiki/Collision_(computer_science)
|
|
4758
4876
|
*/
|
|
4759
4877
|
hashCode(): number;
|
|
4760
4878
|
}
|
|
@@ -4762,6 +4880,10 @@ declare module Immutable {
|
|
|
4762
4880
|
/**
|
|
4763
4881
|
* Deeply converts plain JS objects and arrays to Immutable Maps and Lists.
|
|
4764
4882
|
*
|
|
4883
|
+
* `fromJS` will convert Arrays and [array-like objects][2] to a List, and
|
|
4884
|
+
* plain objects (without a custom prototype) to a Map. [Iterable objects][3]
|
|
4885
|
+
* may be converted to List, Map, or Set.
|
|
4886
|
+
*
|
|
4765
4887
|
* If a `reviver` is optionally provided, it will be called with every
|
|
4766
4888
|
* collection as a Seq (beginning with the most nested collections
|
|
4767
4889
|
* and proceeding to the top-level collection itself), along with the key
|
|
@@ -4784,10 +4906,6 @@ declare module Immutable {
|
|
|
4784
4906
|
* }
|
|
4785
4907
|
* ```
|
|
4786
4908
|
*
|
|
4787
|
-
* `fromJS` is conservative in its conversion. It will only convert
|
|
4788
|
-
* arrays which pass `Array.isArray` to Lists, and only raw objects (no custom
|
|
4789
|
-
* prototype) to Map.
|
|
4790
|
-
*
|
|
4791
4909
|
* Accordingly, this example converts native JS data to OrderedMap and List:
|
|
4792
4910
|
*
|
|
4793
4911
|
* <!-- runkit:activate -->
|
|
@@ -4824,15 +4942,19 @@ declare module Immutable {
|
|
|
4824
4942
|
*
|
|
4825
4943
|
* [1]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/JSON/parse#Example.3A_Using_the_reviver_parameter
|
|
4826
4944
|
* "Using the reviver parameter"
|
|
4945
|
+
* [2]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Indexed_collections#working_with_array-like_objects
|
|
4946
|
+
* "Working with array-like objects"
|
|
4947
|
+
* [3]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols#the_iterable_protocol
|
|
4948
|
+
* "The iterable protocol"
|
|
4827
4949
|
*/
|
|
4828
|
-
|
|
4829
|
-
jsValue:
|
|
4950
|
+
function fromJS(
|
|
4951
|
+
jsValue: unknown,
|
|
4830
4952
|
reviver?: (
|
|
4831
4953
|
key: string | number,
|
|
4832
|
-
sequence: Collection.Keyed<string,
|
|
4954
|
+
sequence: Collection.Keyed<string, unknown> | Collection.Indexed<unknown>,
|
|
4833
4955
|
path?: Array<string | number>
|
|
4834
|
-
) =>
|
|
4835
|
-
):
|
|
4956
|
+
) => unknown
|
|
4957
|
+
): Collection<unknown, unknown>;
|
|
4836
4958
|
|
|
4837
4959
|
/**
|
|
4838
4960
|
* Value equality check with semantics similar to `Object.is`, but treats
|
|
@@ -4859,7 +4981,7 @@ declare module Immutable {
|
|
|
4859
4981
|
* Note: Unlike `Object.is`, `Immutable.is` assumes `0` and `-0` are the same
|
|
4860
4982
|
* value, matching the behavior of ES6 Map key equality.
|
|
4861
4983
|
*/
|
|
4862
|
-
|
|
4984
|
+
function is(first: unknown, second: unknown): boolean;
|
|
4863
4985
|
|
|
4864
4986
|
/**
|
|
4865
4987
|
* The `hash()` function is an important part of how Immutable determines if
|
|
@@ -4883,7 +5005,7 @@ declare module Immutable {
|
|
|
4883
5005
|
*
|
|
4884
5006
|
* *New in Version 4.0*
|
|
4885
5007
|
*/
|
|
4886
|
-
|
|
5008
|
+
function hash(value: unknown): number;
|
|
4887
5009
|
|
|
4888
5010
|
/**
|
|
4889
5011
|
* True if `maybeImmutable` is an Immutable Collection or Record.
|
|
@@ -4901,7 +5023,9 @@ declare module Immutable {
|
|
|
4901
5023
|
* isImmutable(Map().asMutable()); // true
|
|
4902
5024
|
* ```
|
|
4903
5025
|
*/
|
|
4904
|
-
|
|
5026
|
+
function isImmutable(
|
|
5027
|
+
maybeImmutable: unknown
|
|
5028
|
+
): maybeImmutable is Collection<unknown, unknown>;
|
|
4905
5029
|
|
|
4906
5030
|
/**
|
|
4907
5031
|
* True if `maybeCollection` is a Collection, or any of its subclasses.
|
|
@@ -4916,7 +5040,9 @@ declare module Immutable {
|
|
|
4916
5040
|
* isCollection(Stack()); // true
|
|
4917
5041
|
* ```
|
|
4918
5042
|
*/
|
|
4919
|
-
|
|
5043
|
+
function isCollection(
|
|
5044
|
+
maybeCollection: unknown
|
|
5045
|
+
): maybeCollection is Collection<unknown, unknown>;
|
|
4920
5046
|
|
|
4921
5047
|
/**
|
|
4922
5048
|
* True if `maybeKeyed` is a Collection.Keyed, or any of its subclasses.
|
|
@@ -4931,7 +5057,9 @@ declare module Immutable {
|
|
|
4931
5057
|
* isKeyed(Stack()); // false
|
|
4932
5058
|
* ```
|
|
4933
5059
|
*/
|
|
4934
|
-
|
|
5060
|
+
function isKeyed(
|
|
5061
|
+
maybeKeyed: unknown
|
|
5062
|
+
): maybeKeyed is Collection.Keyed<unknown, unknown>;
|
|
4935
5063
|
|
|
4936
5064
|
/**
|
|
4937
5065
|
* True if `maybeIndexed` is a Collection.Indexed, or any of its subclasses.
|
|
@@ -4947,7 +5075,9 @@ declare module Immutable {
|
|
|
4947
5075
|
* isIndexed(Set()); // false
|
|
4948
5076
|
* ```
|
|
4949
5077
|
*/
|
|
4950
|
-
|
|
5078
|
+
function isIndexed(
|
|
5079
|
+
maybeIndexed: unknown
|
|
5080
|
+
): maybeIndexed is Collection.Indexed<unknown>;
|
|
4951
5081
|
|
|
4952
5082
|
/**
|
|
4953
5083
|
* True if `maybeAssociative` is either a Keyed or Indexed Collection.
|
|
@@ -4963,7 +5093,11 @@ declare module Immutable {
|
|
|
4963
5093
|
* isAssociative(Set()); // false
|
|
4964
5094
|
* ```
|
|
4965
5095
|
*/
|
|
4966
|
-
|
|
5096
|
+
function isAssociative(
|
|
5097
|
+
maybeAssociative: unknown
|
|
5098
|
+
): maybeAssociative is
|
|
5099
|
+
| Collection.Keyed<unknown, unknown>
|
|
5100
|
+
| Collection.Indexed<unknown>;
|
|
4967
5101
|
|
|
4968
5102
|
/**
|
|
4969
5103
|
* True if `maybeOrdered` is a Collection where iteration order is well
|
|
@@ -4980,7 +5114,7 @@ declare module Immutable {
|
|
|
4980
5114
|
* isOrdered(Set()); // false
|
|
4981
5115
|
* ```
|
|
4982
5116
|
*/
|
|
4983
|
-
|
|
5117
|
+
function isOrdered(maybeOrdered: unknown): boolean;
|
|
4984
5118
|
|
|
4985
5119
|
/**
|
|
4986
5120
|
* True if `maybeValue` is a JavaScript Object which has *both* `equals()`
|
|
@@ -4989,54 +5123,60 @@ declare module Immutable {
|
|
|
4989
5123
|
* Any two instances of *value objects* can be compared for value equality with
|
|
4990
5124
|
* `Immutable.is()` and can be used as keys in a `Map` or members in a `Set`.
|
|
4991
5125
|
*/
|
|
4992
|
-
|
|
4993
|
-
|
|
5126
|
+
function isValueObject(maybeValue: unknown): maybeValue is ValueObject;
|
|
4994
5127
|
|
|
4995
5128
|
/**
|
|
4996
5129
|
* True if `maybeSeq` is a Seq.
|
|
4997
5130
|
*/
|
|
4998
|
-
|
|
5131
|
+
function isSeq(
|
|
5132
|
+
maybeSeq: unknown
|
|
5133
|
+
): maybeSeq is
|
|
5134
|
+
| Seq.Indexed<unknown>
|
|
5135
|
+
| Seq.Keyed<unknown, unknown>
|
|
5136
|
+
| Seq.Set<unknown>;
|
|
4999
5137
|
|
|
5000
5138
|
/**
|
|
5001
5139
|
* True if `maybeList` is a List.
|
|
5002
5140
|
*/
|
|
5003
|
-
|
|
5141
|
+
function isList(maybeList: unknown): maybeList is List<unknown>;
|
|
5004
5142
|
|
|
5005
5143
|
/**
|
|
5006
5144
|
* True if `maybeMap` is a Map.
|
|
5007
5145
|
*
|
|
5008
5146
|
* Also true for OrderedMaps.
|
|
5009
5147
|
*/
|
|
5010
|
-
|
|
5148
|
+
function isMap(maybeMap: unknown): maybeMap is Map<unknown, unknown>;
|
|
5011
5149
|
|
|
5012
5150
|
/**
|
|
5013
5151
|
* True if `maybeOrderedMap` is an OrderedMap.
|
|
5014
5152
|
*/
|
|
5015
|
-
|
|
5153
|
+
function isOrderedMap(
|
|
5154
|
+
maybeOrderedMap: unknown
|
|
5155
|
+
): maybeOrderedMap is OrderedMap<unknown, unknown>;
|
|
5016
5156
|
|
|
5017
5157
|
/**
|
|
5018
5158
|
* True if `maybeStack` is a Stack.
|
|
5019
5159
|
*/
|
|
5020
|
-
|
|
5160
|
+
function isStack(maybeStack: unknown): maybeStack is Stack<unknown>;
|
|
5021
5161
|
|
|
5022
5162
|
/**
|
|
5023
5163
|
* True if `maybeSet` is a Set.
|
|
5024
5164
|
*
|
|
5025
5165
|
* Also true for OrderedSets.
|
|
5026
5166
|
*/
|
|
5027
|
-
|
|
5167
|
+
function isSet(maybeSet: unknown): maybeSet is Set<unknown>;
|
|
5028
5168
|
|
|
5029
5169
|
/**
|
|
5030
5170
|
* True if `maybeOrderedSet` is an OrderedSet.
|
|
5031
5171
|
*/
|
|
5032
|
-
|
|
5172
|
+
function isOrderedSet(
|
|
5173
|
+
maybeOrderedSet: unknown
|
|
5174
|
+
): maybeOrderedSet is OrderedSet<unknown>;
|
|
5033
5175
|
|
|
5034
5176
|
/**
|
|
5035
5177
|
* True if `maybeRecord` is a Record.
|
|
5036
5178
|
*/
|
|
5037
|
-
|
|
5038
|
-
|
|
5039
|
-
|
|
5179
|
+
function isRecord(maybeRecord: unknown): maybeRecord is Record<{}>;
|
|
5040
5180
|
|
|
5041
5181
|
/**
|
|
5042
5182
|
* Returns the value within the provided collection associated with the
|
|
@@ -5053,14 +5193,34 @@ declare module Immutable {
|
|
|
5053
5193
|
* get({ x: 123, y: 456 }, 'z', 'ifNotSet') // 'ifNotSet'
|
|
5054
5194
|
* ```
|
|
5055
5195
|
*/
|
|
5056
|
-
|
|
5057
|
-
|
|
5058
|
-
|
|
5059
|
-
|
|
5060
|
-
|
|
5061
|
-
|
|
5062
|
-
|
|
5063
|
-
|
|
5196
|
+
function get<K, V>(collection: Collection<K, V>, key: K): V | undefined;
|
|
5197
|
+
function get<K, V, NSV>(
|
|
5198
|
+
collection: Collection<K, V>,
|
|
5199
|
+
key: K,
|
|
5200
|
+
notSetValue: NSV
|
|
5201
|
+
): V | NSV;
|
|
5202
|
+
function get<TProps extends object, K extends keyof TProps>(
|
|
5203
|
+
record: Record<TProps>,
|
|
5204
|
+
key: K,
|
|
5205
|
+
notSetValue: unknown
|
|
5206
|
+
): TProps[K];
|
|
5207
|
+
function get<V>(collection: Array<V>, key: number): V | undefined;
|
|
5208
|
+
function get<V, NSV>(
|
|
5209
|
+
collection: Array<V>,
|
|
5210
|
+
key: number,
|
|
5211
|
+
notSetValue: NSV
|
|
5212
|
+
): V | NSV;
|
|
5213
|
+
function get<C extends object, K extends keyof C>(
|
|
5214
|
+
object: C,
|
|
5215
|
+
key: K,
|
|
5216
|
+
notSetValue: unknown
|
|
5217
|
+
): C[K];
|
|
5218
|
+
function get<V>(collection: { [key: string]: V }, key: string): V | undefined;
|
|
5219
|
+
function get<V, NSV>(
|
|
5220
|
+
collection: { [key: string]: V },
|
|
5221
|
+
key: string,
|
|
5222
|
+
notSetValue: NSV
|
|
5223
|
+
): V | NSV;
|
|
5064
5224
|
|
|
5065
5225
|
/**
|
|
5066
5226
|
* Returns true if the key is defined in the provided collection.
|
|
@@ -5078,7 +5238,7 @@ declare module Immutable {
|
|
|
5078
5238
|
* has({ x: 123, y: 456 }, 'z') // false
|
|
5079
5239
|
* ```
|
|
5080
5240
|
*/
|
|
5081
|
-
|
|
5241
|
+
function has(collection: object, key: unknown): boolean;
|
|
5082
5242
|
|
|
5083
5243
|
/**
|
|
5084
5244
|
* Returns a copy of the collection with the value at key removed.
|
|
@@ -5098,11 +5258,21 @@ declare module Immutable {
|
|
|
5098
5258
|
* console.log(originalObject) // { x: 123, y: 456 }
|
|
5099
5259
|
* ```
|
|
5100
5260
|
*/
|
|
5101
|
-
|
|
5102
|
-
|
|
5103
|
-
|
|
5104
|
-
|
|
5105
|
-
|
|
5261
|
+
function remove<K, C extends Collection<K, unknown>>(
|
|
5262
|
+
collection: C,
|
|
5263
|
+
key: K
|
|
5264
|
+
): C;
|
|
5265
|
+
function remove<
|
|
5266
|
+
TProps extends object,
|
|
5267
|
+
C extends Record<TProps>,
|
|
5268
|
+
K extends keyof TProps
|
|
5269
|
+
>(collection: C, key: K): C;
|
|
5270
|
+
function remove<C extends Array<unknown>>(collection: C, key: number): C;
|
|
5271
|
+
function remove<C, K extends keyof C>(collection: C, key: K): C;
|
|
5272
|
+
function remove<C extends { [key: string]: unknown }, K extends keyof C>(
|
|
5273
|
+
collection: C,
|
|
5274
|
+
key: K
|
|
5275
|
+
): C;
|
|
5106
5276
|
|
|
5107
5277
|
/**
|
|
5108
5278
|
* Returns a copy of the collection with the value at key set to the provided
|
|
@@ -5123,11 +5293,23 @@ declare module Immutable {
|
|
|
5123
5293
|
* console.log(originalObject) // { x: 123, y: 456 }
|
|
5124
5294
|
* ```
|
|
5125
5295
|
*/
|
|
5126
|
-
|
|
5127
|
-
|
|
5128
|
-
|
|
5129
|
-
|
|
5130
|
-
|
|
5296
|
+
function set<K, V, C extends Collection<K, V>>(
|
|
5297
|
+
collection: C,
|
|
5298
|
+
key: K,
|
|
5299
|
+
value: V
|
|
5300
|
+
): C;
|
|
5301
|
+
function set<
|
|
5302
|
+
TProps extends object,
|
|
5303
|
+
C extends Record<TProps>,
|
|
5304
|
+
K extends keyof TProps
|
|
5305
|
+
>(record: C, key: K, value: TProps[K]): C;
|
|
5306
|
+
function set<V, C extends Array<V>>(collection: C, key: number, value: V): C;
|
|
5307
|
+
function set<C, K extends keyof C>(object: C, key: K, value: C[K]): C;
|
|
5308
|
+
function set<V, C extends { [key: string]: V }>(
|
|
5309
|
+
collection: C,
|
|
5310
|
+
key: string,
|
|
5311
|
+
value: V
|
|
5312
|
+
): C;
|
|
5131
5313
|
|
|
5132
5314
|
/**
|
|
5133
5315
|
* Returns a copy of the collection with the value at key set to the result of
|
|
@@ -5148,16 +5330,66 @@ declare module Immutable {
|
|
|
5148
5330
|
* console.log(originalObject) // { x: 123, y: 456 }
|
|
5149
5331
|
* ```
|
|
5150
5332
|
*/
|
|
5151
|
-
|
|
5152
|
-
|
|
5153
|
-
|
|
5154
|
-
|
|
5155
|
-
|
|
5156
|
-
|
|
5157
|
-
|
|
5158
|
-
|
|
5159
|
-
|
|
5160
|
-
|
|
5333
|
+
function update<K, V, C extends Collection<K, V>>(
|
|
5334
|
+
collection: C,
|
|
5335
|
+
key: K,
|
|
5336
|
+
updater: (value: V | undefined) => V
|
|
5337
|
+
): C;
|
|
5338
|
+
function update<K, V, C extends Collection<K, V>, NSV>(
|
|
5339
|
+
collection: C,
|
|
5340
|
+
key: K,
|
|
5341
|
+
notSetValue: NSV,
|
|
5342
|
+
updater: (value: V | NSV) => V
|
|
5343
|
+
): C;
|
|
5344
|
+
function update<
|
|
5345
|
+
TProps extends object,
|
|
5346
|
+
C extends Record<TProps>,
|
|
5347
|
+
K extends keyof TProps
|
|
5348
|
+
>(record: C, key: K, updater: (value: TProps[K]) => TProps[K]): C;
|
|
5349
|
+
function update<
|
|
5350
|
+
TProps extends object,
|
|
5351
|
+
C extends Record<TProps>,
|
|
5352
|
+
K extends keyof TProps,
|
|
5353
|
+
NSV
|
|
5354
|
+
>(
|
|
5355
|
+
record: C,
|
|
5356
|
+
key: K,
|
|
5357
|
+
notSetValue: NSV,
|
|
5358
|
+
updater: (value: TProps[K] | NSV) => TProps[K]
|
|
5359
|
+
): C;
|
|
5360
|
+
function update<V>(
|
|
5361
|
+
collection: Array<V>,
|
|
5362
|
+
key: number,
|
|
5363
|
+
updater: (value: V) => V
|
|
5364
|
+
): Array<V>;
|
|
5365
|
+
function update<V, NSV>(
|
|
5366
|
+
collection: Array<V>,
|
|
5367
|
+
key: number,
|
|
5368
|
+
notSetValue: NSV,
|
|
5369
|
+
updater: (value: V | NSV) => V
|
|
5370
|
+
): Array<V>;
|
|
5371
|
+
function update<C, K extends keyof C>(
|
|
5372
|
+
object: C,
|
|
5373
|
+
key: K,
|
|
5374
|
+
updater: (value: C[K]) => C[K]
|
|
5375
|
+
): C;
|
|
5376
|
+
function update<C, K extends keyof C, NSV>(
|
|
5377
|
+
object: C,
|
|
5378
|
+
key: K,
|
|
5379
|
+
notSetValue: NSV,
|
|
5380
|
+
updater: (value: C[K] | NSV) => C[K]
|
|
5381
|
+
): C;
|
|
5382
|
+
function update<V, C extends { [key: string]: V }, K extends keyof C>(
|
|
5383
|
+
collection: C,
|
|
5384
|
+
key: K,
|
|
5385
|
+
updater: (value: V) => V
|
|
5386
|
+
): { [key: string]: V };
|
|
5387
|
+
function update<V, C extends { [key: string]: V }, K extends keyof C, NSV>(
|
|
5388
|
+
collection: C,
|
|
5389
|
+
key: K,
|
|
5390
|
+
notSetValue: NSV,
|
|
5391
|
+
updater: (value: V | NSV) => V
|
|
5392
|
+
): { [key: string]: V };
|
|
5161
5393
|
|
|
5162
5394
|
/**
|
|
5163
5395
|
* Returns the value at the provided key path starting at the provided
|
|
@@ -5173,7 +5405,11 @@ declare module Immutable {
|
|
|
5173
5405
|
* getIn({ x: { y: { z: 123 }}}, ['x', 'q', 'p'], 'ifNotSet') // 'ifNotSet'
|
|
5174
5406
|
* ```
|
|
5175
5407
|
*/
|
|
5176
|
-
|
|
5408
|
+
function getIn(
|
|
5409
|
+
collection: unknown,
|
|
5410
|
+
keyPath: Iterable<unknown>,
|
|
5411
|
+
notSetValue?: unknown
|
|
5412
|
+
): unknown;
|
|
5177
5413
|
|
|
5178
5414
|
/**
|
|
5179
5415
|
* Returns true if the key path is defined in the provided collection.
|
|
@@ -5188,7 +5424,7 @@ declare module Immutable {
|
|
|
5188
5424
|
* hasIn({ x: { y: { z: 123 }}}, ['x', 'q', 'p']) // false
|
|
5189
5425
|
* ```
|
|
5190
5426
|
*/
|
|
5191
|
-
|
|
5427
|
+
function hasIn(collection: unknown, keyPath: Iterable<unknown>): boolean;
|
|
5192
5428
|
|
|
5193
5429
|
/**
|
|
5194
5430
|
* Returns a copy of the collection with the value at the key path removed.
|
|
@@ -5204,7 +5440,7 @@ declare module Immutable {
|
|
|
5204
5440
|
* console.log(original) // { x: { y: { z: 123 }}}
|
|
5205
5441
|
* ```
|
|
5206
5442
|
*/
|
|
5207
|
-
|
|
5443
|
+
function removeIn<C>(collection: C, keyPath: Iterable<unknown>): C;
|
|
5208
5444
|
|
|
5209
5445
|
/**
|
|
5210
5446
|
* Returns a copy of the collection with the value at the key path set to the
|
|
@@ -5221,7 +5457,11 @@ declare module Immutable {
|
|
|
5221
5457
|
* console.log(original) // { x: { y: { z: 123 }}}
|
|
5222
5458
|
* ```
|
|
5223
5459
|
*/
|
|
5224
|
-
|
|
5460
|
+
function setIn<C>(
|
|
5461
|
+
collection: C,
|
|
5462
|
+
keyPath: Iterable<unknown>,
|
|
5463
|
+
value: unknown
|
|
5464
|
+
): C;
|
|
5225
5465
|
|
|
5226
5466
|
/**
|
|
5227
5467
|
* Returns a copy of the collection with the value at key path set to the
|
|
@@ -5238,8 +5478,17 @@ declare module Immutable {
|
|
|
5238
5478
|
* console.log(original) // { x: { y: { z: 123 }}}
|
|
5239
5479
|
* ```
|
|
5240
5480
|
*/
|
|
5241
|
-
|
|
5242
|
-
|
|
5481
|
+
function updateIn<C>(
|
|
5482
|
+
collection: C,
|
|
5483
|
+
keyPath: Iterable<unknown>,
|
|
5484
|
+
updater: (value: unknown) => unknown
|
|
5485
|
+
): C;
|
|
5486
|
+
function updateIn<C>(
|
|
5487
|
+
collection: C,
|
|
5488
|
+
keyPath: Iterable<unknown>,
|
|
5489
|
+
notSetValue: unknown,
|
|
5490
|
+
updater: (value: unknown) => unknown
|
|
5491
|
+
): C;
|
|
5243
5492
|
|
|
5244
5493
|
/**
|
|
5245
5494
|
* Returns a copy of the collection with the remaining collections merged in.
|
|
@@ -5255,9 +5504,13 @@ declare module Immutable {
|
|
|
5255
5504
|
* console.log(original) // { x: 123, y: 456 }
|
|
5256
5505
|
* ```
|
|
5257
5506
|
*/
|
|
5258
|
-
|
|
5507
|
+
function merge<C>(
|
|
5259
5508
|
collection: C,
|
|
5260
|
-
...collections: Array<
|
|
5509
|
+
...collections: Array<
|
|
5510
|
+
| Iterable<unknown>
|
|
5511
|
+
| Iterable<[unknown, unknown]>
|
|
5512
|
+
| { [key: string]: unknown }
|
|
5513
|
+
>
|
|
5261
5514
|
): C;
|
|
5262
5515
|
|
|
5263
5516
|
/**
|
|
@@ -5279,15 +5532,29 @@ declare module Immutable {
|
|
|
5279
5532
|
* console.log(original) // { x: 123, y: 456 }
|
|
5280
5533
|
* ```
|
|
5281
5534
|
*/
|
|
5282
|
-
|
|
5283
|
-
merger: (oldVal:
|
|
5535
|
+
function mergeWith<C>(
|
|
5536
|
+
merger: (oldVal: unknown, newVal: unknown, key: unknown) => unknown,
|
|
5284
5537
|
collection: C,
|
|
5285
|
-
...collections: Array<
|
|
5538
|
+
...collections: Array<
|
|
5539
|
+
| Iterable<unknown>
|
|
5540
|
+
| Iterable<[unknown, unknown]>
|
|
5541
|
+
| { [key: string]: unknown }
|
|
5542
|
+
>
|
|
5286
5543
|
): C;
|
|
5287
5544
|
|
|
5288
5545
|
/**
|
|
5289
|
-
*
|
|
5290
|
-
* deeply
|
|
5546
|
+
* Like `merge()`, but when two compatible collections are encountered with
|
|
5547
|
+
* the same key, it merges them as well, recursing deeply through the nested
|
|
5548
|
+
* data. Two collections are considered to be compatible (and thus will be
|
|
5549
|
+
* merged together) if they both fall into one of three categories: keyed
|
|
5550
|
+
* (e.g., `Map`s, `Record`s, and objects), indexed (e.g., `List`s and
|
|
5551
|
+
* arrays), or set-like (e.g., `Set`s). If they fall into separate
|
|
5552
|
+
* categories, `mergeDeep` will replace the existing collection with the
|
|
5553
|
+
* collection being merged in. This behavior can be customized by using
|
|
5554
|
+
* `mergeDeepWith()`.
|
|
5555
|
+
*
|
|
5556
|
+
* Note: Indexed and set-like collections are merged using
|
|
5557
|
+
* `concat()`/`union()` and therefore do not recurse.
|
|
5291
5558
|
*
|
|
5292
5559
|
* A functional alternative to `collection.mergeDeep()` which will also work
|
|
5293
5560
|
* with plain Objects and Arrays.
|
|
@@ -5300,15 +5567,20 @@ declare module Immutable {
|
|
|
5300
5567
|
* console.log(original) // { x: { y: 123 }}
|
|
5301
5568
|
* ```
|
|
5302
5569
|
*/
|
|
5303
|
-
|
|
5570
|
+
function mergeDeep<C>(
|
|
5304
5571
|
collection: C,
|
|
5305
|
-
...collections: Array<
|
|
5572
|
+
...collections: Array<
|
|
5573
|
+
| Iterable<unknown>
|
|
5574
|
+
| Iterable<[unknown, unknown]>
|
|
5575
|
+
| { [key: string]: unknown }
|
|
5576
|
+
>
|
|
5306
5577
|
): C;
|
|
5307
5578
|
|
|
5308
5579
|
/**
|
|
5309
|
-
*
|
|
5310
|
-
*
|
|
5311
|
-
* value
|
|
5580
|
+
* Like `mergeDeep()`, but when two non-collections or incompatible
|
|
5581
|
+
* collections are encountered at the same key, it uses the `merger` function
|
|
5582
|
+
* to determine the resulting value. Collections are considered incompatible
|
|
5583
|
+
* if they fall into separate categories between keyed, indexed, and set-like.
|
|
5312
5584
|
*
|
|
5313
5585
|
* A functional alternative to `collection.mergeDeepWith()` which will also
|
|
5314
5586
|
* work with plain Objects and Arrays.
|
|
@@ -5325,13 +5597,37 @@ declare module Immutable {
|
|
|
5325
5597
|
* console.log(original) // { x: { y: 123 }}
|
|
5326
5598
|
* ```
|
|
5327
5599
|
*/
|
|
5328
|
-
|
|
5329
|
-
merger: (oldVal:
|
|
5600
|
+
function mergeDeepWith<C>(
|
|
5601
|
+
merger: (oldVal: unknown, newVal: unknown, key: unknown) => unknown,
|
|
5330
5602
|
collection: C,
|
|
5331
|
-
...collections: Array<
|
|
5603
|
+
...collections: Array<
|
|
5604
|
+
| Iterable<unknown>
|
|
5605
|
+
| Iterable<[unknown, unknown]>
|
|
5606
|
+
| { [key: string]: unknown }
|
|
5607
|
+
>
|
|
5332
5608
|
): C;
|
|
5333
5609
|
}
|
|
5334
5610
|
|
|
5335
|
-
|
|
5336
|
-
|
|
5337
|
-
|
|
5611
|
+
/**
|
|
5612
|
+
* Defines the main export of the immutable module to be the Immutable namespace
|
|
5613
|
+
* This supports many common module import patterns:
|
|
5614
|
+
*
|
|
5615
|
+
* const Immutable = require("immutable");
|
|
5616
|
+
* const { List } = require("immutable");
|
|
5617
|
+
* import Immutable from "immutable";
|
|
5618
|
+
* import * as Immutable from "immutable";
|
|
5619
|
+
* import { List } from "immutable";
|
|
5620
|
+
*
|
|
5621
|
+
*/
|
|
5622
|
+
export = Immutable;
|
|
5623
|
+
|
|
5624
|
+
/**
|
|
5625
|
+
* A global "Immutable" namespace used by UMD modules which allows the use of
|
|
5626
|
+
* the full Immutable API.
|
|
5627
|
+
*
|
|
5628
|
+
* If using Immutable as an imported module, prefer using:
|
|
5629
|
+
*
|
|
5630
|
+
* import Immutable from 'immutable'
|
|
5631
|
+
*
|
|
5632
|
+
*/
|
|
5633
|
+
export as namespace Immutable;
|