immutable 4.0.0-rc.5 → 4.0.0-rc.9

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.
@@ -32,6 +32,29 @@
32
32
  // some constructors and functions.
33
33
  type PlainObjInput<K, V> = {[key: K]: V, __proto__: null};
34
34
 
35
+ // Helper types to extract the "keys" and "values" use by the *In() methods.
36
+ type $KeyOf<C> = $Call<
37
+ & (<K>(?_Collection<K, mixed>) => K)
38
+ & (<T>(?$ReadOnlyArray<T>) => number)
39
+ & (<T>(?RecordInstance<T> | T) => $Keys<T>),
40
+ C
41
+ >;
42
+
43
+ type $ValOf<C, K = $KeyOf<C>> = $Call<
44
+ & (<V>(?_Collection<any, V>) => V)
45
+ & (<T>(?$ReadOnlyArray<T>) => T)
46
+ & (<T, K: $Keys<T>>(?RecordInstance<T> | T, K) => $ElementType<T, K>)
47
+ & (<V>(?{[any]: V}) => V),
48
+ C,
49
+ K
50
+ >;
51
+
52
+ type $IterableOf<C> = $Call<
53
+ & (<V: Array<any> | IndexedCollection<any> | SetCollection<any>>(V) => Iterable<$ValOf<V>>)
54
+ & (<V: KeyedCollection<any, any> | RecordInstance<any> | PlainObjInput<any, any>>(V) => Iterable<[$KeyOf<V>, $ValOf<V>]>),
55
+ C
56
+ >;
57
+
35
58
  declare class _Collection<K, +V> /*implements ValueObject*/ {
36
59
  equals(other: mixed): boolean;
37
60
  hashCode(): number;
@@ -43,8 +66,14 @@ declare class _Collection<K, +V> /*implements ValueObject*/ {
43
66
  first(): V | void;
44
67
  last(): V | void;
45
68
 
46
- getIn(searchKeyPath: Iterable<mixed>, notSetValue?: mixed): any;
47
- hasIn(searchKeyPath: Iterable<mixed>): boolean;
69
+ hasIn(keyPath: Iterable<mixed>): boolean;
70
+
71
+ getIn(keyPath: [], notSetValue?: mixed): this;
72
+ getIn<NSV>(keyPath: [K], notSetValue: NSV): V | NSV;
73
+ getIn<NSV, K2: $KeyOf<V>>(keyPath: [K, K2], notSetValue: NSV): $ValOf<V, K2> | NSV;
74
+ getIn<NSV, K2: $KeyOf<V>, K3: $KeyOf<$ValOf<V, K2>>>(keyPath: [K, K2, K3], notSetValue: NSV): $ValOf<$ValOf<V, K2>, K3> | NSV;
75
+ getIn<NSV, K2: $KeyOf<V>, K3: $KeyOf<$ValOf<V, K2>>, K4: $KeyOf<$ValOf<$ValOf<V, K2>, K3>>>(keyPath: [K, K2, K3, K4], notSetValue: NSV): $ValOf<$ValOf<$ValOf<V, K2>, K3>, K4> | NSV;
76
+ getIn<NSV, K2: $KeyOf<V>, K3: $KeyOf<$ValOf<V, K2>>, K4: $KeyOf<$ValOf<$ValOf<V, K2>, K3>>, K5: $KeyOf<$ValOf<$ValOf<$ValOf<V, K2>, K3>, K4>>>(keyPath: [K, K2, K3, K4, K5], notSetValue: NSV): $ValOf<$ValOf<$ValOf<$ValOf<V, K2>, K3>, K4>, K5> | NSV;
48
77
 
49
78
  update<U>(updater: (value: this) => U): U;
50
79
 
@@ -101,11 +130,6 @@ declare class _Collection<K, +V> /*implements ValueObject*/ {
101
130
  takeWhile(predicate: (value: V, key: K, iter: this) => mixed, context?: mixed): this;
102
131
  takeUntil(predicate: (value: V, key: K, iter: this) => mixed, context?: mixed): this;
103
132
 
104
- filter(
105
- predicate: (value: V, key: K, iter: this) => mixed,
106
- context?: mixed
107
- ): this;
108
-
109
133
  filterNot(
110
134
  predicate: (value: V, key: K, iter: this) => mixed,
111
135
  context?: mixed
@@ -204,8 +228,7 @@ declare class Collection<K, +V> extends _Collection<K, V> {
204
228
  }
205
229
 
206
230
  declare class KeyedCollection<K, +V> extends Collection<K, V> {
207
- static <K, V>(iter?: Iterable<[K, V]>): KeyedCollection<K, V>;
208
- static <K, V>(obj?: PlainObjInput<K, V>): KeyedCollection<K, V>;
231
+ static <K, V>(values?: Iterable<[K, V]> | PlainObjInput<K, V>): KeyedCollection<K, V>;
209
232
 
210
233
  toJS(): { [key: string]: mixed };
211
234
  toJSON(): { [key: string]: V };
@@ -214,8 +237,13 @@ declare class KeyedCollection<K, +V> extends Collection<K, V> {
214
237
  toSeq(): KeyedSeq<K, V>;
215
238
  flip(): KeyedCollection<V, K>;
216
239
 
217
- concat<KC, VC>(...iters: Array<Iterable<[KC, VC]>>): KeyedCollection<K | KC, V | VC>;
218
- concat<KC, VC>(...iters: Array<PlainObjInput<KC, VC>>): KeyedCollection<K | KC, V | VC>;
240
+ concat<KC, VC>(...iters: Array<Iterable<[KC, VC]> | PlainObjInput<KC, VC>>): KeyedCollection<K | KC, V | VC>;
241
+
242
+ filter(predicate: typeof Boolean): KeyedCollection<K, $NonMaybeType<V>>;
243
+ filter(
244
+ predicate: (value: V, key: K, iter: this) => mixed,
245
+ context?: mixed
246
+ ): KeyedCollection<K, V>;
219
247
 
220
248
  map<M>(
221
249
  mapper: (value: V, key: K, iter: this) => M,
@@ -371,6 +399,12 @@ declare class IndexedCollection<+T> extends Collection<number, T> {
371
399
 
372
400
  concat<C>(...iters: Array<Iterable<C> | C>): IndexedCollection<T | C>;
373
401
 
402
+ filter(predicate: typeof Boolean): IndexedCollection<$NonMaybeType<T>>;
403
+ filter(
404
+ predicate: (value: T, index: number, iter: this) => mixed,
405
+ context?: mixed
406
+ ): IndexedCollection<T>;
407
+
374
408
  map<M>(
375
409
  mapper: (value: T, index: number, iter: this) => M,
376
410
  context?: mixed
@@ -394,12 +428,18 @@ declare class SetCollection<+T> extends Collection<T, T> {
394
428
  @@iterator(): Iterator<T>;
395
429
  toSeq(): SetSeq<T>;
396
430
 
397
- concat<C>(...iters: Array<Iterable<C> | C>): SetCollection<T | C>;
431
+ concat<U>(...collections: Iterable<U>[]): SetCollection<T | U>;
432
+
433
+ // `filter`, `map` and `flatMap` cannot be defined further up the hierarchy,
434
+ // because the implementation for `KeyedCollection` allows the value type to
435
+ // change without constraining the key type. That does not work for
436
+ // `SetCollection` - the value and key types *must* match.
437
+ filter(predicate: typeof Boolean): SetCollection<$NonMaybeType<T>>;
438
+ filter(
439
+ predicate: (value: T, value: T, iter: this) => mixed,
440
+ context?: mixed
441
+ ): SetCollection<T>;
398
442
 
399
- // `map` and `flatMap` cannot be defined further up the hierarchy, because the
400
- // implementation for `KeyedCollection` allows the value type to change without
401
- // constraining the key type. That does not work for `SetCollection` - the value
402
- // and key types *must* match.
403
443
  map<M>(
404
444
  mapper: (value: T, value: T, iter: this) => M,
405
445
  context?: mixed
@@ -420,10 +460,10 @@ declare class Seq<K, +V> extends _Collection<K, V> {
420
460
  static Indexed: typeof IndexedSeq;
421
461
  static Set: typeof SetSeq;
422
462
 
423
- static <K, V>(iter: KeyedSeq<K, V>): KeyedSeq<K, V>;
424
- static <T>(iter: SetSeq<T>): SetSeq<K, V>;
425
- static <T>(iter?: Iterable<T>): IndexedSeq<T>;
426
- static <K, V>(iter: PlainObjInput<K, V>): KeyedSeq<K, V>;
463
+ static <K, V>(values: KeyedSeq<K, V>): KeyedSeq<K, V>;
464
+ static <T>(values: SetSeq<T>): SetSeq<K, V>;
465
+ static <T>(values: Iterable<T>): IndexedSeq<T>;
466
+ static <K, V>(values?: PlainObjInput<K, V>): KeyedSeq<K, V>;
427
467
 
428
468
  static isSeq: typeof isSeq;
429
469
 
@@ -433,14 +473,18 @@ declare class Seq<K, +V> extends _Collection<K, V> {
433
473
  }
434
474
 
435
475
  declare class KeyedSeq<K, +V> extends Seq<K, V> mixins KeyedCollection<K, V> {
436
- static <K, V>(iter?: Iterable<[K, V]>): KeyedSeq<K, V>;
437
- static <K, V>(iter?: PlainObjInput<K, V>): KeyedSeq<K, V>;
476
+ static <K, V>(values?: Iterable<[K, V]> | PlainObjInput<K, V>): KeyedSeq<K, V>;
438
477
 
439
478
  // Override specialized return types
440
479
  flip(): KeyedSeq<V, K>;
441
480
 
442
- concat<KC, VC>(...iters: Array<Iterable<[KC, VC]>>): KeyedSeq<K | KC, V | VC>;
443
- concat<KC, VC>(...iters: Array<PlainObjInput<KC, VC>>): KeyedSeq<K | KC, V | VC>;
481
+ concat<KC, VC>(...iters: Array<Iterable<[KC, VC]> | PlainObjInput<KC, VC>>): KeyedSeq<K | KC, V | VC>;
482
+
483
+ filter(predicate: typeof Boolean): KeyedSeq<K, $NonMaybeType<V>>;
484
+ filter(
485
+ predicate: (value: V, key: K, iter: this) => mixed,
486
+ context?: mixed
487
+ ): KeyedSeq<K, V>;
444
488
 
445
489
  map<M>(
446
490
  mapper: (value: V, key: K, iter: this) => M,
@@ -467,7 +511,7 @@ declare class KeyedSeq<K, +V> extends Seq<K, V> mixins KeyedCollection<K, V> {
467
511
  }
468
512
 
469
513
  declare class IndexedSeq<+T> extends Seq<number, T> mixins IndexedCollection<T> {
470
- static <T>(iter?: Iterable<T>): IndexedSeq<T>;
514
+ static <T>(values?: Iterable<T>): IndexedSeq<T>;
471
515
 
472
516
  static of<T>(...values: T[]): IndexedSeq<T>;
473
517
 
@@ -475,6 +519,12 @@ declare class IndexedSeq<+T> extends Seq<number, T> mixins IndexedCollection<T>
475
519
 
476
520
  concat<C>(...iters: Array<Iterable<C> | C>): IndexedSeq<T | C>;
477
521
 
522
+ filter(predicate: typeof Boolean): IndexedSeq<$NonMaybeType<T>>;
523
+ filter(
524
+ predicate: (value: T, index: number, iter: this) => mixed,
525
+ context?: mixed
526
+ ): IndexedSeq<T>;
527
+
478
528
  map<M>(
479
529
  mapper: (value: T, index: number, iter: this) => M,
480
530
  context?: mixed
@@ -588,13 +638,19 @@ declare class IndexedSeq<+T> extends Seq<number, T> mixins IndexedCollection<T>
588
638
  }
589
639
 
590
640
  declare class SetSeq<+T> extends Seq<T, T> mixins SetCollection<T> {
591
- static <T>(iter?: Iterable<T>): IndexedSeq<T>;
641
+ static <T>(values?: Iterable<T>): SetSeq<T>;
592
642
 
593
643
  static of<T>(...values: T[]): SetSeq<T>;
594
644
 
595
645
  // Override specialized return types
596
646
 
597
- concat<C>(...iters: Array<Iterable<C> | C>): SetSeq<T | C>;
647
+ concat<U>(...collections: Iterable<U>[]): SetSeq<T | U>;
648
+
649
+ filter(predicate: typeof Boolean): SetSeq<$NonMaybeType<T>>;
650
+ filter(
651
+ predicate: (value: T, value: T, iter: this) => mixed,
652
+ context?: mixed
653
+ ): SetSeq<T>;
598
654
 
599
655
  map<M>(
600
656
  mapper: (value: T, value: T, iter: this) => M,
@@ -610,8 +666,44 @@ declare class SetSeq<+T> extends Seq<T, T> mixins SetCollection<T> {
610
666
  flatten(shallow?: boolean): SetSeq<any>;
611
667
  }
612
668
 
669
+ declare class UpdatableInCollection<K, +V> {
670
+ setIn<S>(keyPath: [], value: S): S;
671
+ setIn(keyPath: [K], value: V): this;
672
+ setIn<K2: $KeyOf<V>, S: $ValOf<V, K2>>(keyPath: [K, K2], value: S): this;
673
+ setIn<K2: $KeyOf<V>, K3: $KeyOf<$ValOf<V, K2>>, S: $ValOf<$ValOf<V, K2>, K3>>(keyPath: [K, K2, K3], value: S): this;
674
+ setIn<K2: $KeyOf<V>, K3: $KeyOf<$ValOf<V, K2>>, K4: $KeyOf<$ValOf<$ValOf<V, K2>, K3>>, S: $ValOf<$ValOf<$ValOf<V, K2>, K3>, K4>>(keyPath: [K, K2, K3, K4], value: S): this;
675
+ setIn<K2: $KeyOf<V>, K3: $KeyOf<$ValOf<V, K2>>, K4: $KeyOf<$ValOf<$ValOf<V, K2>, K3>>, K5: $KeyOf<$ValOf<$ValOf<$ValOf<V, K2>, K3>, K4>>, S: $ValOf<$ValOf<$ValOf<$ValOf<V, K2>, K3>, K4>, K5>>(keyPath: [K, K2, K3, K4, K5], value: S): this;
676
+
677
+ deleteIn(keyPath: []): void;
678
+ deleteIn(keyPath: [K]): this;
679
+ deleteIn<K2: $KeyOf<V>>(keyPath: [K, K2]): this;
680
+ deleteIn<K2: $KeyOf<V>, K3: $KeyOf<$ValOf<V, K2>>>(keyPath: [K, K2, K3]): this;
681
+ deleteIn<K2: $KeyOf<V>, K3: $KeyOf<$ValOf<V, K2>>, K4: $KeyOf<$ValOf<$ValOf<V, K2>, K3>>>(keyPath: [K, K2, K3, K4]): this;
682
+ deleteIn<K2: $KeyOf<V>, K3: $KeyOf<$ValOf<V, K2>>, K4: $KeyOf<$ValOf<$ValOf<V, K2>, K3>>, K5: $KeyOf<$ValOf<$ValOf<$ValOf<V, K2>, K3>, K4>>>(keyPath: [K, K2, K3, K4, K5]): this;
683
+
684
+ removeIn(keyPath: []): void;
685
+ removeIn(keyPath: [K]): this;
686
+ removeIn<K2: $KeyOf<V>>(keyPath: [K, K2]): this;
687
+ removeIn<K2: $KeyOf<V>, K3: $KeyOf<$ValOf<V, K2>>>(keyPath: [K, K2, K3]): this;
688
+ removeIn<K2: $KeyOf<V>, K3: $KeyOf<$ValOf<V, K2>>, K4: $KeyOf<$ValOf<$ValOf<V, K2>, K3>>>(keyPath: [K, K2, K3, K4]): this;
689
+ removeIn<K2: $KeyOf<V>, K3: $KeyOf<$ValOf<V, K2>>, K4: $KeyOf<$ValOf<$ValOf<V, K2>, K3>>, K5: $KeyOf<$ValOf<$ValOf<$ValOf<V, K2>, K3>, K4>>>(keyPath: [K, K2, K3, K4, K5]): this;
690
+
691
+ updateIn<U>(keyPath: [], notSetValue: mixed, updater: (value: this) => U): U;
692
+ updateIn<U>(keyPath: [], updater: (value: this) => U): U;
693
+ updateIn<NSV>(keyPath: [K], notSetValue: NSV, updater: (value: V) => V): this;
694
+ updateIn(keyPath: [K], updater: (value: V) => V): this;
695
+ updateIn<NSV, K2: $KeyOf<V>, S: $ValOf<V, K2>>(keyPath: [K, K2], notSetValue: NSV, updater: (value: $ValOf<V, K2> | NSV) => S): this;
696
+ updateIn<K2: $KeyOf<V>, S: $ValOf<V, K2>>(keyPath: [K, K2], updater: (value: $ValOf<V, K2>) => S): this;
697
+ updateIn<NSV, K2: $KeyOf<V>, K3: $KeyOf<$ValOf<V, K2>>, S: $ValOf<$ValOf<V, K2>, K3>>(keyPath: [K, K2, K3], notSetValue: NSV, updater: (value: $ValOf<$ValOf<V, K2>, K3> | NSV) => S): this;
698
+ updateIn<K2: $KeyOf<V>, K3: $KeyOf<$ValOf<V, K2>>, S: $ValOf<$ValOf<V, K2>, K3>>(keyPath: [K, K2, K3], updater: (value: $ValOf<$ValOf<V, K2>, K3>) => S): this;
699
+ updateIn<NSV, K2: $KeyOf<V>, K3: $KeyOf<$ValOf<V, K2>>, K4: $KeyOf<$ValOf<$ValOf<V, K2>, K3>>, S: $ValOf<$ValOf<$ValOf<V, K2>, K3>, K4>>(keyPath: [K, K2, K3, K4], notSetValue: NSV, updater: (value: $ValOf<$ValOf<$ValOf<V, K2>, K3>, K4> | NSV) => S): this;
700
+ updateIn<K2: $KeyOf<V>, K3: $KeyOf<$ValOf<V, K2>>, K4: $KeyOf<$ValOf<$ValOf<V, K2>, K3>>, S: $ValOf<$ValOf<$ValOf<V, K2>, K3>, K4>>(keyPath: [K, K2, K3, K4], updater: (value: $ValOf<$ValOf<$ValOf<V, K2>, K3>, K4>) => S): this;
701
+ updateIn<NSV, K2: $KeyOf<V>, K3: $KeyOf<$ValOf<V, K2>>, K4: $KeyOf<$ValOf<$ValOf<V, K2>, K3>>, K5: $KeyOf<$ValOf<$ValOf<$ValOf<V, K2>, K3>, K4>>, S: $ValOf<$ValOf<$ValOf<$ValOf<V, K2>, K3>, K4>, K5>>(keyPath: [K, K2, K3, K4, K5], notSetValue: NSV, updater: (value: $ValOf<$ValOf<$ValOf<$ValOf<V, K2>, K3>, K4>, K5> | NSV) => S): this;
702
+ updateIn<K2: $KeyOf<V>, K3: $KeyOf<$ValOf<V, K2>>, K4: $KeyOf<$ValOf<$ValOf<V, K2>, K3>>, K5: $KeyOf<$ValOf<$ValOf<$ValOf<V, K2>, K3>, K4>>, S: $ValOf<$ValOf<$ValOf<$ValOf<V, K2>, K3>, K4>, K5>>(keyPath: [K, K2, K3, K4, K5], updater: (value: $ValOf<$ValOf<$ValOf<$ValOf<V, K2>, K3>, K4>, K5>) => S): this;
703
+ }
704
+
613
705
  declare function isList(maybeList: mixed): boolean %checks(maybeList instanceof List);
614
- declare class List<+T> extends IndexedCollection<T> {
706
+ declare class List<+T> extends IndexedCollection<T> mixins UpdatableInCollection<number, T> {
615
707
  static (collection?: Iterable<T>): List<T>;
616
708
 
617
709
  static of<T>(...values: T[]): List<T>;
@@ -637,19 +729,6 @@ declare class List<+T> extends IndexedCollection<T> {
637
729
  merge<U>(...collections: Iterable<U>[]): List<T | U>;
638
730
 
639
731
  setSize(size: number): this;
640
- setIn(keyPath: Iterable<mixed>, value: mixed): this;
641
- deleteIn(keyPath: Iterable<mixed>, value: mixed): this;
642
- removeIn(keyPath: Iterable<mixed>, value: mixed): this;
643
-
644
- updateIn(
645
- keyPath: Iterable<mixed>,
646
- notSetValue: mixed,
647
- updater: (value: any) => mixed
648
- ): this;
649
- updateIn(
650
- keyPath: Iterable<mixed>,
651
- updater: (value: any) => mixed
652
- ): this;
653
732
 
654
733
  mergeIn(keyPath: Iterable<mixed>, ...collections: Iterable<mixed>[]): this;
655
734
  mergeDeepIn(keyPath: Iterable<mixed>, ...collections: Iterable<mixed>[]): this;
@@ -663,6 +742,12 @@ declare class List<+T> extends IndexedCollection<T> {
663
742
 
664
743
  concat<C>(...iters: Array<Iterable<C> | C>): List<T | C>;
665
744
 
745
+ filter(predicate: typeof Boolean): List<$NonMaybeType<T>>;
746
+ filter(
747
+ predicate: (value: T, index: number, iter: this) => mixed,
748
+ context?: mixed
749
+ ): List<T>;
750
+
666
751
  map<M>(
667
752
  mapper: (value: T, index: number, iter: this) => M,
668
753
  context?: mixed
@@ -776,9 +861,8 @@ declare class List<+T> extends IndexedCollection<T> {
776
861
  }
777
862
 
778
863
  declare function isMap(maybeMap: mixed): boolean %checks(maybeMap instanceof Map);
779
- declare class Map<K, +V> extends KeyedCollection<K, V> {
780
- static <K, V>(collection: Iterable<[K, V]>): Map<K, V>;
781
- static <K, V>(obj?: PlainObjInput<K, V>): Map<K, V>;
864
+ declare class Map<K, +V> extends KeyedCollection<K, V> mixins UpdatableInCollection<K, V> {
865
+ static <K, V>(values?: Iterable<[K, V]> | PlainObjInput<K, V>): Map<K, V>;
782
866
 
783
867
  static isMap: typeof isMap;
784
868
 
@@ -799,6 +883,9 @@ declare class Map<K, +V> extends KeyedCollection<K, V> {
799
883
  merge<K_, V_>(
800
884
  ...collections: (Iterable<[K_, V_]> | PlainObjInput<K_, V_>)[]
801
885
  ): Map<K | K_, V | V_>;
886
+ concat<K_, V_>(
887
+ ...collections: (Iterable<[K_, V_]> | PlainObjInput<K_, V_>)[]
888
+ ): Map<K | K_, V | V_>;
802
889
 
803
890
  mergeWith<K_, W, X>(
804
891
  merger: (oldVal: V, newVal: W, key: K) => X,
@@ -814,27 +901,13 @@ declare class Map<K, +V> extends KeyedCollection<K, V> {
814
901
  ...collections: (Iterable<[K_, W]> | PlainObjInput<K_, W>)[]
815
902
  ): Map<K | K_, V | W | X>;
816
903
 
817
- setIn(keyPath: Iterable<mixed>, value: mixed): this;
818
- deleteIn(keyPath: Iterable<mixed>, value: mixed): this;
819
- removeIn(keyPath: Iterable<mixed>, value: mixed): this;
820
-
821
- updateIn(
822
- keyPath: Iterable<mixed>,
823
- notSetValue: mixed,
824
- updater: (value: any) => mixed
825
- ): this;
826
- updateIn(
827
- keyPath: Iterable<mixed>,
828
- updater: (value: any) => mixed
829
- ): this;
830
-
831
904
  mergeIn(
832
- keyPath: Iterable<K>,
833
- ...collections: (Iterable<K> | PlainObjInput<mixed, mixed>)[]
905
+ keyPath: Iterable<mixed>,
906
+ ...collections: (Iterable<mixed> | PlainObjInput<mixed, mixed>)[]
834
907
  ): this;
835
908
  mergeDeepIn(
836
- keyPath: Iterable<K>,
837
- ...collections: (Iterable<K> | PlainObjInput<mixed, mixed>)[]
909
+ keyPath: Iterable<mixed>,
910
+ ...collections: (Iterable<mixed> | PlainObjInput<mixed, mixed>)[]
838
911
  ): this;
839
912
 
840
913
  withMutations(mutator: (mutable: this) => mixed): this;
@@ -846,8 +919,11 @@ declare class Map<K, +V> extends KeyedCollection<K, V> {
846
919
 
847
920
  flip(): Map<V, K>;
848
921
 
849
- concat<KC, VC>(...iters: Array<Iterable<[KC, VC]>>): Map<K | KC, V | VC>;
850
- concat<KC, VC>(...iters: Array<PlainObjInput<KC, VC>>): Map<K | KC, V | VC>;
922
+ filter(predicate: typeof Boolean): Map<K, $NonMaybeType<V>>;
923
+ filter(
924
+ predicate: (value: V, key: K, iter: this) => mixed,
925
+ context?: mixed
926
+ ): Map<K, V>;
851
927
 
852
928
  map<M>(
853
929
  mapper: (value: V, key: K, iter: this) => M,
@@ -874,9 +950,8 @@ declare class Map<K, +V> extends KeyedCollection<K, V> {
874
950
  }
875
951
 
876
952
  declare function isOrderedMap(maybeOrderedMap: mixed): boolean %checks(maybeOrderedMap instanceof OrderedMap);
877
- declare class OrderedMap<K, +V> extends Map<K, V> {
878
- static <K, V>(collection: Iterable<[K, V]>): OrderedMap<K, V>;
879
- static <K, V>(obj?: PlainObjInput<K, V>): OrderedMap<K, V>;
953
+ declare class OrderedMap<K, +V> extends Map<K, V> mixins UpdatableInCollection<K, V> {
954
+ static <K, V>(values?: Iterable<[K, V]> | PlainObjInput<K, V>): OrderedMap<K, V>;
880
955
 
881
956
  static isOrderedMap: typeof isOrderedMap;
882
957
 
@@ -894,6 +969,9 @@ declare class OrderedMap<K, +V> extends Map<K, V> {
894
969
  merge<K_, V_>(
895
970
  ...collections: (Iterable<[K_, V_]> | PlainObjInput<K_, V_>)[]
896
971
  ): OrderedMap<K | K_, V | V_>;
972
+ concat<K_, V_>(
973
+ ...collections: (Iterable<[K_, V_]> | PlainObjInput<K_, V_>)[]
974
+ ): OrderedMap<K | K_, V | V_>;
897
975
 
898
976
  mergeWith<K_, W, X>(
899
977
  merger: (oldVal: V, newVal: W, key: K) => X,
@@ -909,27 +987,13 @@ declare class OrderedMap<K, +V> extends Map<K, V> {
909
987
  ...collections: (Iterable<[K_, W]> | PlainObjInput<K_, W>)[]
910
988
  ): OrderedMap<K | K_, V | W | X>;
911
989
 
912
- setIn(keyPath: Iterable<mixed>, value: mixed): this;
913
- deleteIn(keyPath: Iterable<mixed>, value: mixed): this;
914
- removeIn(keyPath: Iterable<mixed>, value: mixed): this;
915
-
916
- updateIn(
917
- keyPath: Iterable<mixed>,
918
- notSetValue: mixed,
919
- updater: (value: any) => mixed
920
- ): this;
921
- updateIn(
922
- keyPath: Iterable<mixed>,
923
- updater: (value: any) => mixed
924
- ): this;
925
-
926
990
  mergeIn(
927
- keyPath: Iterable<K>,
928
- ...collections: (Iterable<K> | PlainObjInput<mixed, mixed>)[]
991
+ keyPath: Iterable<mixed>,
992
+ ...collections: (Iterable<mixed> | PlainObjInput<mixed, mixed>)[]
929
993
  ): this;
930
994
  mergeDeepIn(
931
- keyPath: Iterable<K>,
932
- ...collections: (Iterable<K> | PlainObjInput<mixed, mixed>)[]
995
+ keyPath: Iterable<mixed>,
996
+ ...collections: (Iterable<mixed> | PlainObjInput<mixed, mixed>)[]
933
997
  ): this;
934
998
 
935
999
  withMutations(mutator: (mutable: this) => mixed): this;
@@ -941,8 +1005,11 @@ declare class OrderedMap<K, +V> extends Map<K, V> {
941
1005
 
942
1006
  flip(): OrderedMap<V, K>;
943
1007
 
944
- concat<KC, VC>(...iters: Array<Iterable<[KC, VC]>>): OrderedMap<K | KC, V | VC>;
945
- concat<KC, VC>(...iters: Array<PlainObjInput<KC, VC>>): OrderedMap<K | KC, V | VC>;
1008
+ filter(predicate: typeof Boolean): OrderedMap<K, $NonMaybeType<V>>;
1009
+ filter(
1010
+ predicate: (value: V, key: K, iter: this) => mixed,
1011
+ context?: mixed
1012
+ ): OrderedMap<K, V>;
946
1013
 
947
1014
  map<M>(
948
1015
  mapper: (value: V, key: K, iter: this) => M,
@@ -970,11 +1037,10 @@ declare class OrderedMap<K, +V> extends Map<K, V> {
970
1037
 
971
1038
  declare function isSet(maybeSet: mixed): boolean %checks(maybeSet instanceof Set);
972
1039
  declare class Set<+T> extends SetCollection<T> {
973
- static <T>(collection?: Iterable<T>): Set<T>;
1040
+ static <T>(values?: Iterable<T>): Set<T>;
974
1041
 
975
1042
  static of<T>(...values: T[]): Set<T>;
976
- static fromKeys<T>(iter: Iterable<[T, mixed]>): Set<T>;
977
- static fromKeys<K>(object: PlainObjInput<K, mixed>): Set<K>;
1043
+ static fromKeys<T>(values: Iterable<[T, mixed]> | PlainObjInput<T, mixed>): Set<T>;
978
1044
 
979
1045
  static intersect(sets: Iterable<Iterable<T>>): Set<T>;
980
1046
  static union(sets: Iterable<Iterable<T>>): Set<T>;
@@ -989,6 +1055,7 @@ declare class Set<+T> extends SetCollection<T> {
989
1055
  clear(): this;
990
1056
  union<U>(...collections: Iterable<U>[]): Set<T | U>;
991
1057
  merge<U>(...collections: Iterable<U>[]): Set<T | U>;
1058
+ concat<U>(...collections: Iterable<U>[]): Set<T | U>;
992
1059
  intersect<U>(...collections: Iterable<U>[]): Set<T & U>;
993
1060
  subtract(...collections: Iterable<mixed>[]): this;
994
1061
 
@@ -999,7 +1066,11 @@ declare class Set<+T> extends SetCollection<T> {
999
1066
 
1000
1067
  // Override specialized return types
1001
1068
 
1002
- concat<C>(...iters: Array<Iterable<C> | C>): Set<T | C>;
1069
+ filter(predicate: typeof Boolean): Set<$NonMaybeType<T>>;
1070
+ filter(
1071
+ predicate: (value: T, value: T, iter: this) => mixed,
1072
+ context?: mixed
1073
+ ): Set<T>;
1003
1074
 
1004
1075
  map<M>(
1005
1076
  mapper: (value: T, value: T, iter: this) => M,
@@ -1018,12 +1089,10 @@ declare class Set<+T> extends SetCollection<T> {
1018
1089
  // Overrides except for `isOrderedSet` are for specialized return types
1019
1090
  declare function isOrderedSet(maybeOrderedSet: mixed): boolean %checks(maybeOrderedSet instanceof OrderedSet);
1020
1091
  declare class OrderedSet<+T> extends Set<T> {
1021
- static <T>(collection: Iterable<T>): OrderedSet<T>;
1022
- static (_: void): OrderedSet<any>;
1092
+ static <T>(values?: Iterable<T>): OrderedSet<T>;
1023
1093
 
1024
1094
  static of<T>(...values: T[]): OrderedSet<T>;
1025
- static fromKeys<T>(iter: Iterable<[T, mixed]>): OrderedSet<T>;
1026
- static fromKeys<K>(object: PlainObjInput<K, mixed>): OrderedSet<K>;
1095
+ static fromKeys<T>(values: Iterable<[T, mixed]> | PlainObjInput<T, mixed>): OrderedSet<T>;
1027
1096
 
1028
1097
  static isOrderedSet: typeof isOrderedSet;
1029
1098
 
@@ -1032,9 +1101,14 @@ declare class OrderedSet<+T> extends Set<T> {
1032
1101
  add<U>(value: U): OrderedSet<T | U>;
1033
1102
  union<U>(...collections: Iterable<U>[]): OrderedSet<T | U>;
1034
1103
  merge<U>(...collections: Iterable<U>[]): OrderedSet<T | U>;
1104
+ concat<U>(...collections: Iterable<U>[]): OrderedSet<T | U>;
1035
1105
  intersect<U>(...collections: Iterable<U>[]): OrderedSet<T & U>;
1036
1106
 
1037
- concat<C>(...iters: Array<Iterable<C> | C>): OrderedSet<T | C>;
1107
+ filter(predicate: typeof Boolean): OrderedSet<$NonMaybeType<T>>;
1108
+ filter(
1109
+ predicate: (value: T, value: T, iter: this) => mixed,
1110
+ context?: mixed
1111
+ ): OrderedSet<T>;
1038
1112
 
1039
1113
  map<M>(
1040
1114
  mapper: (value: T, value: T, iter: this) => M,
@@ -1177,6 +1251,12 @@ declare class Stack<+T> extends IndexedCollection<T> {
1177
1251
 
1178
1252
  concat<C>(...iters: Array<Iterable<C> | C>): Stack<T | C>;
1179
1253
 
1254
+ filter(predicate: typeof Boolean): Stack<$NonMaybeType<T>>;
1255
+ filter(
1256
+ predicate: (value: T, index: number, iter: this) => mixed,
1257
+ context?: mixed
1258
+ ): Stack<T>;
1259
+
1180
1260
  map<M>(
1181
1261
  mapper: (value: T, index: number, iter: this) => M,
1182
1262
  context?: mixed
@@ -1298,6 +1378,10 @@ type RecordFactory<Values: Object> = Class<RecordInstance<Values>>;
1298
1378
  // The type of runtime Record instances.
1299
1379
  type RecordOf<Values: Object> = RecordInstance<Values> & Values;
1300
1380
 
1381
+ // The values of a Record instance.
1382
+ type _RecordValues<T, R: RecordInstance<T> | T> = R;
1383
+ type RecordValues<R> = _RecordValues<*, R>;
1384
+
1301
1385
  declare function isRecord(maybeRecord: any): boolean %checks(maybeRecord instanceof RecordInstance);
1302
1386
  declare class Record {
1303
1387
  static <Values: Object>(spec: Values, name?: string): RecordFactory<Values>;
@@ -1309,43 +1393,82 @@ declare class Record {
1309
1393
  }
1310
1394
 
1311
1395
  declare class RecordInstance<T: Object> {
1312
- static (values?: $Shape<T> | Iterable<[string, any]>): RecordOf<T>;
1396
+ static (values?: Iterable<[$Keys<T>, $ValOf<T>]> | $Shape<T>): RecordOf<T>;
1313
1397
  // Note: a constructor can only create an instance of RecordInstance<T>,
1314
1398
  // it's encouraged to not use `new` when creating Records.
1315
- constructor (values?: $Shape<T> | Iterable<[string, any]>): void;
1399
+ constructor (values?: Iterable<[$Keys<T>, $ValOf<T>]> | $Shape<T>): void;
1316
1400
 
1317
1401
  size: number;
1318
1402
 
1319
1403
  has(key: string): boolean;
1320
- get<K: $Keys<T>>(key: K): $ElementType<T, K>;
1404
+ get<K: $Keys<T>>(key: K, notSetValue: mixed): $ElementType<T, K>;
1405
+
1406
+ hasIn(keyPath: Iterable<mixed>): boolean;
1407
+
1408
+ getIn(keyPath: [], notSetValue?: mixed): this & T;
1409
+ getIn<K: $Keys<T>>(keyPath: [K], notSetValue?: mixed): $ElementType<T, K>;
1410
+ getIn<NSV, K: $Keys<T>, K2: $KeyOf<$ValOf<T, K>>>(keyPath: [K, K2], notSetValue: NSV): $ValOf<$ValOf<T, K>, K2> | NSV;
1411
+ getIn<NSV, K: $Keys<T>, K2: $KeyOf<$ValOf<T, K>>, K3: $KeyOf<$ValOf<$ValOf<T, K>, K2>>>(keyPath: [K, K2, K3], notSetValue: NSV): $ValOf<$ValOf<$ValOf<T, K>, K2>, K3> | NSV;
1412
+ getIn<NSV, K: $Keys<T>, K2: $KeyOf<$ValOf<T, K>>, K3: $KeyOf<$ValOf<$ValOf<T, K>, K2>>, K4: $KeyOf<$ValOf<$ValOf<$ValOf<T, K>, K2>, K3>>>(keyPath: [K, K2, K3, K4], notSetValue: NSV): $ValOf<$ValOf<$ValOf<$ValOf<T, K>, K2>, K3>, K4> | NSV;
1413
+ getIn<NSV, K: $Keys<T>, K2: $KeyOf<$ValOf<T, K>>, K3: $KeyOf<$ValOf<$ValOf<T, K>, K2>>, K4: $KeyOf<$ValOf<$ValOf<$ValOf<T, K>, K2>, K3>>, K5: $KeyOf<$ValOf<$ValOf<$ValOf<$ValOf<T, K>, K2>, K3>, K4>>>(keyPath: [K, K2, K3, K4, K5], notSetValue: NSV): $ValOf<$ValOf<$ValOf<$ValOf<$ValOf<T, K>, K2>, K3>, K4>, K5> | NSV;
1321
1414
 
1322
1415
  equals(other: any): boolean;
1323
1416
  hashCode(): number;
1324
1417
 
1325
1418
  set<K: $Keys<T>>(key: K, value: $ElementType<T, K>): this & T;
1326
1419
  update<K: $Keys<T>>(key: K, updater: (value: $ElementType<T, K>) => $ElementType<T, K>): this & T;
1327
- merge(...collections: Array<$Shape<T> | Iterable<[string, any]>>): this & T;
1328
- mergeDeep(...collections: Array<$Shape<T> | Iterable<[string, any]>>): this & T;
1420
+ merge(...collections: Array<Iterable<[$Keys<T>, $ValOf<T>]> | $Shape<T>>): this & T;
1421
+ mergeDeep(...collections: Array<Iterable<[$Keys<T>, $ValOf<T>]> | $Shape<T>>): this & T;
1329
1422
 
1330
1423
  mergeWith(
1331
- merger: (oldVal: any, newVal: any, key: $Keys<T>) => any,
1332
- ...collections: Array<$Shape<T> | Iterable<[string, any]>>
1424
+ merger: (oldVal: $ValOf<T>, newVal: $ValOf<T>, key: $Keys<T>) => $ValOf<T>,
1425
+ ...collections: Array<Iterable<[$Keys<T>, $ValOf<T>]> | $Shape<T>>
1333
1426
  ): this & T;
1334
1427
  mergeDeepWith(
1335
1428
  merger: (oldVal: any, newVal: any, key: any) => any,
1336
- ...collections: Array<$Shape<T> | Iterable<[string, any]>>
1429
+ ...collections: Array<Iterable<[$Keys<T>, $ValOf<T>]> | $Shape<T>>
1337
1430
  ): this & T;
1338
1431
 
1339
1432
  delete<K: $Keys<T>>(key: K): this & T;
1340
1433
  remove<K: $Keys<T>>(key: K): this & T;
1341
1434
  clear(): this & T;
1342
1435
 
1343
- setIn(keyPath: Iterable<any>, value: any): this & T;
1344
- updateIn(keyPath: Iterable<any>, updater: (value: any) => any): this & T;
1345
- mergeIn(keyPath: Iterable<any>, ...collections: Array<any>): this & T;
1346
- mergeDeepIn(keyPath: Iterable<any>, ...collections: Array<any>): this & T;
1347
- deleteIn(keyPath: Iterable<any>): this & T;
1348
- removeIn(keyPath: Iterable<any>): this & T;
1436
+ setIn<S>(keyPath: [], value: S): S;
1437
+ setIn<K: $Keys<T>, S: $ValOf<T, K>>(keyPath: [K], value: S): this & T;
1438
+ setIn<K: $Keys<T>, K2: $KeyOf<$ValOf<T, K>>, S: $ValOf<$ValOf<T, K>, K2>>(keyPath: [K, K2], value: S): this & T;
1439
+ setIn<K: $Keys<T>, K2: $KeyOf<$ValOf<T, K>>, K3: $KeyOf<$ValOf<$ValOf<T, K>, K2>>, S: $ValOf<$ValOf<$ValOf<T, K>, K2>, K3>>(keyPath: [K, K2, K3], value: S): this & T;
1440
+ setIn<K: $Keys<T>, K2: $KeyOf<$ValOf<T, K>>, K3: $KeyOf<$ValOf<$ValOf<T, K>, K2>>, K4: $KeyOf<$ValOf<$ValOf<$ValOf<T, K>, K2>, K3>>, S: $ValOf<$ValOf<$ValOf<$ValOf<T, K>, K2>, K3>, K4>>(keyPath: [K, K2, K3, K4], value: S): this & T;
1441
+ setIn<K: $Keys<T>, K2: $KeyOf<$ValOf<T, K>>, K3: $KeyOf<$ValOf<$ValOf<T, K>, K2>>, K4: $KeyOf<$ValOf<$ValOf<$ValOf<T, K>, K2>, K3>>, K5: $KeyOf<$ValOf<$ValOf<$ValOf<$ValOf<T, K>, K2>, K3>, K4>>, S: $ValOf<$ValOf<$ValOf<$ValOf<$ValOf<T, K>, K2>, K3>, K4>, K5>>(keyPath: [K, K2, K3, K4, K5], value: S): this & T;
1442
+
1443
+ deleteIn(keyPath: []): void;
1444
+ deleteIn<K: $Keys<T>>(keyPath: [K]): this & T;
1445
+ deleteIn<K: $Keys<T>, K2: $KeyOf<$ValOf<T, K>>>(keyPath: [K, K2]): this & T;
1446
+ deleteIn<K: $Keys<T>, K2: $KeyOf<$ValOf<T, K>>, K3: $KeyOf<$ValOf<$ValOf<T, K>, K2>>>(keyPath: [K, K2, K3]): this & T;
1447
+ deleteIn<K: $Keys<T>, K2: $KeyOf<$ValOf<T, K>>, K3: $KeyOf<$ValOf<$ValOf<T, K>, K2>>, K4: $KeyOf<$ValOf<$ValOf<$ValOf<T, K>, K2>, K3>>>(keyPath: [K, K2, K3, K4]): this & T;
1448
+ deleteIn<K: $Keys<T>, K2: $KeyOf<$ValOf<T, K>>, K3: $KeyOf<$ValOf<$ValOf<T, K>, K2>>, K4: $KeyOf<$ValOf<$ValOf<$ValOf<T, K>, K2>, K3>>, K5: $KeyOf<$ValOf<$ValOf<$ValOf<$ValOf<T, K>, K2>, K3>, K4>>>(keyPath: [K, K2, K3, K4, K5]): this & T;
1449
+
1450
+ removeIn(keyPath: []): void;
1451
+ removeIn<K: $Keys<T>>(keyPath: [K]): this & T;
1452
+ removeIn<K: $Keys<T>, K2: $KeyOf<$ValOf<T, K>>>(keyPath: [K, K2]): this & T;
1453
+ removeIn<K: $Keys<T>, K2: $KeyOf<$ValOf<T, K>>, K3: $KeyOf<$ValOf<$ValOf<T, K>, K2>>>(keyPath: [K, K2, K3]): this & T;
1454
+ removeIn<K: $Keys<T>, K2: $KeyOf<$ValOf<T, K>>, K3: $KeyOf<$ValOf<$ValOf<T, K>, K2>>, K4: $KeyOf<$ValOf<$ValOf<$ValOf<T, K>, K2>, K3>>>(keyPath: [K, K2, K3, K4]): this & T;
1455
+ removeIn<K: $Keys<T>, K2: $KeyOf<$ValOf<T, K>>, K3: $KeyOf<$ValOf<$ValOf<T, K>, K2>>, K4: $KeyOf<$ValOf<$ValOf<$ValOf<T, K>, K2>, K3>>, K5: $KeyOf<$ValOf<$ValOf<$ValOf<$ValOf<T, K>, K2>, K3>, K4>>>(keyPath: [K, K2, K3, K4, K5]): this & T;
1456
+
1457
+ updateIn<U>(keyPath: [], notSetValue: mixed, updater: (value: this) => U): U;
1458
+ updateIn<U>(keyPath: [], updater: (value: this) => U): U;
1459
+ updateIn<NSV, K: $Keys<T>, S: $ValOf<T, K>>(keyPath: [K], notSetValue: NSV, updater: (value: $ValOf<T, K>) => S): this & T;
1460
+ updateIn<K: $Keys<T>, S: $ValOf<T, K>>(keyPath: [K], updater: (value: $ValOf<T, K>) => S): this & T;
1461
+ updateIn<NSV, K: $Keys<T>, K2: $KeyOf<$ValOf<T, K>>, S: $ValOf<$ValOf<T, K>, K2>>(keyPath: [K, K2], notSetValue: NSV, updater: (value: $ValOf<$ValOf<T, K>, K2> | NSV) => S): this & T;
1462
+ updateIn<K: $Keys<T>, K2: $KeyOf<$ValOf<T, K>>, S: $ValOf<$ValOf<T, K>, K2>>(keyPath: [K, K2], updater: (value: $ValOf<$ValOf<T, K>, K2>) => S): this & T;
1463
+ updateIn<NSV, K: $Keys<T>, K2: $KeyOf<$ValOf<T, K>>, K3: $KeyOf<$ValOf<$ValOf<T, K>, K2>>, S: $ValOf<$ValOf<$ValOf<T, K>, K2>, K3>>(keyPath: [K, K2, K3], notSetValue: NSV, updater: (value: $ValOf<$ValOf<$ValOf<T, K>, K2>, K3> | NSV) => S): this & T;
1464
+ updateIn<K: $Keys<T>, K2: $KeyOf<$ValOf<T, K>>, K3: $KeyOf<$ValOf<$ValOf<T, K>, K2>>, S: $ValOf<$ValOf<$ValOf<T, K>, K2>, K3>>(keyPath: [K, K2, K3], updater: (value: $ValOf<$ValOf<$ValOf<T, K>, K2>, K3>) => S): this & T;
1465
+ updateIn<NSV, K: $Keys<T>, K2: $KeyOf<$ValOf<T, K>>, K3: $KeyOf<$ValOf<$ValOf<T, K>, K2>>, K4: $KeyOf<$ValOf<$ValOf<$ValOf<T, K>, K2>, K3>>, S: $ValOf<$ValOf<$ValOf<$ValOf<T, K>, K2>, K3>, K4>>(keyPath: [K, K2, K3, K4], notSetValue: NSV, updater: (value: $ValOf<$ValOf<$ValOf<$ValOf<T, K>, K2>, K3>, K4> | NSV) => S): this & T;
1466
+ updateIn<K: $Keys<T>, K2: $KeyOf<$ValOf<T, K>>, K3: $KeyOf<$ValOf<$ValOf<T, K>, K2>>, K4: $KeyOf<$ValOf<$ValOf<$ValOf<T, K>, K2>, K3>>, S: $ValOf<$ValOf<$ValOf<$ValOf<T, K>, K2>, K3>, K4>>(keyPath: [K, K2, K3, K4], updater: (value: $ValOf<$ValOf<$ValOf<$ValOf<T, K>, K2>, K3>, K4>) => S): this & T;
1467
+ updateIn<NSV, K: $Keys<T>, K2: $KeyOf<$ValOf<T, K>>, K3: $KeyOf<$ValOf<$ValOf<T, K>, K2>>, K4: $KeyOf<$ValOf<$ValOf<$ValOf<T, K>, K2>, K3>>, K5: $KeyOf<$ValOf<$ValOf<$ValOf<$ValOf<T, K>, K2>, K3>, K4>>, S: $ValOf<$ValOf<$ValOf<$ValOf<$ValOf<T, K>, K2>, K3>, K4>, K5>>(keyPath: [K, K2, K3, K4, K5], notSetValue: NSV, updater: (value: $ValOf<$ValOf<$ValOf<$ValOf<$ValOf<T, K>, K2>, K3>, K4>, K5> | NSV) => S): this & T;
1468
+ updateIn<K: $Keys<T>, K2: $KeyOf<$ValOf<T, K>>, K3: $KeyOf<$ValOf<$ValOf<T, K>, K2>>, K4: $KeyOf<$ValOf<$ValOf<$ValOf<T, K>, K2>, K3>>, K5: $KeyOf<$ValOf<$ValOf<$ValOf<$ValOf<T, K>, K2>, K3>, K4>>, S: $ValOf<$ValOf<$ValOf<$ValOf<$ValOf<T, K>, K2>, K3>, K4>, K5>>(keyPath: [K, K2, K3, K4, K5], updater: (value: $ValOf<$ValOf<$ValOf<$ValOf<$ValOf<T, K>, K2>, K3>, K4>, K5>) => S): this & T;
1469
+
1470
+ mergeIn(keyPath: Iterable<mixed>, ...collections: Array<any>): this & T;
1471
+ mergeDeepIn(keyPath: Iterable<mixed>, ...collections: Array<any>): this & T;
1349
1472
 
1350
1473
  toSeq(): KeyedSeq<$Keys<T>, any>;
1351
1474
 
@@ -1358,7 +1481,7 @@ declare class RecordInstance<T: Object> {
1358
1481
  wasAltered(): boolean;
1359
1482
  asImmutable(): this & T;
1360
1483
 
1361
- @@iterator(): Iterator<[$Keys<T>, any]>;
1484
+ @@iterator(): Iterator<[$Keys<T>, $ValOf<T>]>;
1362
1485
  }
1363
1486
 
1364
1487
  declare function fromJS(
@@ -1373,6 +1496,70 @@ declare function fromJS(
1373
1496
  declare function is(first: mixed, second: mixed): boolean;
1374
1497
  declare function hash(value: mixed): number;
1375
1498
 
1499
+ declare function get<C: Object, K: $Keys<C>>(collection: C, key: K, notSetValue: mixed): $ValOf<C, K>;
1500
+ declare function get<C, K: $KeyOf<C>, NSV>(collection: C, key: K, notSetValue: NSV): $ValOf<C, K> | NSV;
1501
+
1502
+ declare function has(collection: Object, key: mixed): boolean;
1503
+ declare function remove<C>(collection: C, key: $KeyOf<C>): C;
1504
+ declare function set<C, K: $KeyOf<C>, V: $ValOf<C, K>>(collection: C, key: K, value: V): C;
1505
+ declare function update<C, K: $KeyOf<C>, V: $ValOf<C, K>, NSV>(collection: C, key: K, notSetValue: NSV, updater: ($ValOf<C, K> | NSV) => V): C;
1506
+ declare function update<C, K: $KeyOf<C>, V: $ValOf<C, K>>(collection: C, key: K, updater: ($ValOf<C, K>) => V): C;
1507
+
1508
+ declare function getIn<C>(collection: C, keyPath: [], notSetValue?: mixed): C;
1509
+ declare function getIn<C, K: $KeyOf<C>, NSV>(collection: C, keyPath: [K], notSetValue: NSV): $ValOf<C, K> | NSV;
1510
+ declare function getIn<C, K: $KeyOf<C>, K2: $KeyOf<$ValOf<C, K>>, NSV>(collection: C, keyPath: [K, K2], notSetValue: NSV): $ValOf<$ValOf<C, K>, K2> | NSV;
1511
+ declare function getIn<C, K: $KeyOf<C>, K2: $KeyOf<$ValOf<C, K>>, K3: $KeyOf<$ValOf<$ValOf<C, K>, K2>>, NSV>(collection: C, keyPath: [K, K2, K3], notSetValue: NSV): $ValOf<$ValOf<$ValOf<C, K>, K2>, K3> | NSV;
1512
+ declare function getIn<C, K: $KeyOf<C>, K2: $KeyOf<$ValOf<C, K>>, K3: $KeyOf<$ValOf<$ValOf<C, K>, K2>>, K4: $KeyOf<$ValOf<$ValOf<$ValOf<C, K>, K2>, K3>>, NSV>(collection: C, keyPath: [K, K2, K3, K4], notSetValue: NSV): $ValOf<$ValOf<$ValOf<$ValOf<C, K>, K2>, K3>, K4> | NSV;
1513
+ declare function getIn<C, K: $KeyOf<C>, K2: $KeyOf<$ValOf<C, K>>, K3: $KeyOf<$ValOf<$ValOf<C, K>, K2>>, K4: $KeyOf<$ValOf<$ValOf<$ValOf<C, K>, K2>, K3>>, K5: $KeyOf<$ValOf<$ValOf<$ValOf<$ValOf<C, K>, K2>, K3>, K4>>, NSV>(collection: C, keyPath: [K, K2, K3, K4, K5], notSetValue: NSV): $ValOf<$ValOf<$ValOf<$ValOf<$ValOf<C, K>, K2>, K3>, K4>, K5> | NSV;
1514
+
1515
+ declare function hasIn(collection: Object, keyPath: Iterable<mixed>): boolean;
1516
+
1517
+ declare function removeIn<C>(collection: C, keyPath: []): void;
1518
+ declare function removeIn<C, K: $KeyOf<C>>(collection: C, keyPath: [K]): C;
1519
+ declare function removeIn<C, K: $KeyOf<C>, K2: $KeyOf<$ValOf<C>>>(collection: C, keyPath: [K, K2]): C;
1520
+ declare function removeIn<C, K: $KeyOf<C>, K2: $KeyOf<$ValOf<C>>, K3: $KeyOf<$ValOf<$ValOf<C>, K2>>>(collection: C, keyPath: [K, K2, K3]): C;
1521
+ declare function removeIn<C, K: $KeyOf<C>, K2: $KeyOf<$ValOf<C>>, K3: $KeyOf<$ValOf<$ValOf<C>, K2>>, K4: $KeyOf<$ValOf<$ValOf<$ValOf<C>, K2>, K3>>>(collection: C, keyPath: [K, K2, K3, K4]): C;
1522
+ declare function removeIn<C, K: $KeyOf<C>, K2: $KeyOf<$ValOf<C>>, K3: $KeyOf<$ValOf<$ValOf<C>, K2>>, K4: $KeyOf<$ValOf<$ValOf<$ValOf<C>, K2>, K3>>, K5: $KeyOf<$ValOf<$ValOf<$ValOf<$ValOf<C>, K2>, K3>, K4>>>(collection: C, keyPath: [K, K2, K3, K4, K5]): C;
1523
+
1524
+ declare function setIn<S>(collection: Object, keyPath: [], value: S): S;
1525
+ declare function setIn<C, K: $KeyOf<C>, S: $ValOf<C, K>>(collection: C, keyPath: [K], value: S): C;
1526
+ declare function setIn<C, K: $KeyOf<C>, K2: $KeyOf<$ValOf<C, K>>, S: $ValOf<$ValOf<C, K>, K2>>(collection: C, keyPath: [K, K2], value: S): C;
1527
+ declare function setIn<C, K: $KeyOf<C>, K2: $KeyOf<$ValOf<C, K>>, K3: $KeyOf<$ValOf<$ValOf<C, K>, K2>>, S: $ValOf<$ValOf<$ValOf<C, K>, K2>, K3>>(collection: C, keyPath: [K, K2, K3], value: S): C;
1528
+ declare function setIn<C, K: $KeyOf<C>, K2: $KeyOf<$ValOf<C, K>>, K3: $KeyOf<$ValOf<$ValOf<C, K>, K2>>, K4: $KeyOf<$ValOf<$ValOf<$ValOf<C, K>, K2>, K3>>, S: $ValOf<$ValOf<$ValOf<$ValOf<C, K>, K2>, K3>, K4>>(collection: C, keyPath: [K, K2, K3, K4], value: S): C;
1529
+ declare function setIn<C, K: $KeyOf<C>, K2: $KeyOf<$ValOf<C, K>>, K3: $KeyOf<$ValOf<$ValOf<C, K>, K2>>, K4: $KeyOf<$ValOf<$ValOf<$ValOf<C, K>, K2>, K3>>, K5: $KeyOf<$ValOf<$ValOf<$ValOf<$ValOf<C, K>, K2>, K3>, K4>>, S: $ValOf<$ValOf<$ValOf<$ValOf<$ValOf<C, K>, K2>, K3>, K4>, K5>>(collection: C, keyPath: [K, K2, K3, K4, K5], value: S): C;
1530
+
1531
+ declare function updateIn<C, S>(collection: C, keyPath: [], notSetValue: mixed, updater: (value: C) => S): S;
1532
+ declare function updateIn<C, S>(collection: C, keyPath: [], updater: (value: C) => S): S;
1533
+ declare function updateIn<C, K: $KeyOf<C>, S: $ValOf<C, K>, NSV>(collection: C, keyPath: [K], notSetValue: NSV, updater: (value: $ValOf<C, K> | NSV) => S): C;
1534
+ declare function updateIn<C, K: $KeyOf<C>, S: $ValOf<C, K>>(collection: C, keyPath: [K], updater: (value: $ValOf<C, K>) => S): C;
1535
+ declare function updateIn<C, K: $KeyOf<C>, K2: $KeyOf<$ValOf<C, K>>, S: $ValOf<$ValOf<C, K>, K2>, NSV>(collection: C, keyPath: [K, K2], notSetValue: NSV, updater: (value: $ValOf<$ValOf<C, K>, K2> | NSV) => S): C;
1536
+ declare function updateIn<C, K: $KeyOf<C>, K2: $KeyOf<$ValOf<C, K>>, S: $ValOf<$ValOf<C, K>, K2>>(collection: C, keyPath: [K, K2], updater: (value: $ValOf<$ValOf<C, K>, K2>) => S): C;
1537
+ declare function updateIn<C, K: $KeyOf<C>, K2: $KeyOf<$ValOf<C, K>>, K3: $KeyOf<$ValOf<$ValOf<C, K>, K2>>, S: $ValOf<$ValOf<$ValOf<C, K>, K2>, K3>, NSV>(collection: C, keyPath: [K, K2, K3], notSetValue: NSV, updater: (value: $ValOf<$ValOf<$ValOf<C, K>, K2>, K3> | NSV) => S): C;
1538
+ declare function updateIn<C, K: $KeyOf<C>, K2: $KeyOf<$ValOf<C, K>>, K3: $KeyOf<$ValOf<$ValOf<C, K>, K2>>, S: $ValOf<$ValOf<$ValOf<C, K>, K2>, K3>>(collection: C, keyPath: [K, K2, K3], updater: (value: $ValOf<$ValOf<$ValOf<C, K>, K2>, K3>) => S): C;
1539
+ declare function updateIn<C, K: $KeyOf<C>, K2: $KeyOf<$ValOf<C, K>>, K3: $KeyOf<$ValOf<$ValOf<C, K>, K2>>, K4: $KeyOf<$ValOf<$ValOf<$ValOf<C, K>, K2>, K3>>, S: $ValOf<$ValOf<$ValOf<$ValOf<C, K>, K2>, K3>, K4>, NSV>(collection: C, keyPath: [K, K2, K3, K4], notSetValue: NSV, updater: (value: $ValOf<$ValOf<$ValOf<$ValOf<C, K>, K2>, K3>, K4> | NSV) => S): C;
1540
+ declare function updateIn<C, K: $KeyOf<C>, K2: $KeyOf<$ValOf<C, K>>, K3: $KeyOf<$ValOf<$ValOf<C, K>, K2>>, K4: $KeyOf<$ValOf<$ValOf<$ValOf<C, K>, K2>, K3>>, S: $ValOf<$ValOf<$ValOf<$ValOf<C, K>, K2>, K3>, K4>>(collection: C, keyPath: [K, K2, K3, K4], updater: (value: $ValOf<$ValOf<$ValOf<$ValOf<C, K>, K2>, K3>, K4>) => S): C;
1541
+ declare function updateIn<C, K: $KeyOf<C>, K2: $KeyOf<$ValOf<C, K>>, K3: $KeyOf<$ValOf<$ValOf<C, K>, K2>>, K4: $KeyOf<$ValOf<$ValOf<$ValOf<C, K>, K2>, K3>>, K5: $KeyOf<$ValOf<$ValOf<$ValOf<$ValOf<C, K>, K2>, K3>, K4>>, S: $ValOf<$ValOf<$ValOf<$ValOf<$ValOf<C, K>, K2>, K3>, K4>, K5>, NSV>(collection: C, keyPath: [K, K2, K3, K4, K5], notSetValue: NSV, updater: (value: $ValOf<$ValOf<$ValOf<$ValOf<$ValOf<C, K>, K2>, K3>, K4>, K5> | NSV) => S): C;
1542
+ declare function updateIn<C, K: $KeyOf<C>, K2: $KeyOf<$ValOf<C, K>>, K3: $KeyOf<$ValOf<$ValOf<C, K>, K2>>, K4: $KeyOf<$ValOf<$ValOf<$ValOf<C, K>, K2>, K3>>, K5: $KeyOf<$ValOf<$ValOf<$ValOf<$ValOf<C, K>, K2>, K3>, K4>>, S: $ValOf<$ValOf<$ValOf<$ValOf<$ValOf<C, K>, K2>, K3>, K4>, K5>>(collection: C, keyPath: [K, K2, K3, K4, K5], updater: (value: $ValOf<$ValOf<$ValOf<$ValOf<$ValOf<C, K>, K2>, K3>, K4>, K5>) => S): C;
1543
+
1544
+ declare function merge<C>(
1545
+ collection: C,
1546
+ ...collections: Array<$IterableOf<C> | $Shape<RecordValues<C>> | PlainObjInput<$KeyOf<C>, $ValOf<C>>>
1547
+ ): C;
1548
+ declare function mergeWith<C>(
1549
+ merger: (oldVal: $ValOf<C>, newVal: $ValOf<C>, key: $KeyOf<C>) => $ValOf<C>,
1550
+ collection: C,
1551
+ ...collections: Array<$IterableOf<C> | $Shape<RecordValues<C>> | PlainObjInput<$KeyOf<C>, $ValOf<C>>>
1552
+ ): C;
1553
+ declare function mergeDeep<C>(
1554
+ collection: C,
1555
+ ...collections: Array<$IterableOf<C> | $Shape<RecordValues<C>> | PlainObjInput<$KeyOf<C>, $ValOf<C>>>
1556
+ ): C;
1557
+ declare function mergeDeepWith<C>(
1558
+ merger: (oldVal: any, newVal: any, key: any) => mixed,
1559
+ collection: C,
1560
+ ...collections: Array<$IterableOf<C> | $Shape<RecordValues<C>> | PlainObjInput<$KeyOf<C>, $ValOf<C>>>
1561
+ ): C;
1562
+
1376
1563
  export {
1377
1564
  Collection,
1378
1565
  Seq,
@@ -1399,6 +1586,21 @@ export {
1399
1586
  isOrdered,
1400
1587
  isRecord,
1401
1588
  isValueObject,
1589
+
1590
+ get,
1591
+ has,
1592
+ remove,
1593
+ set,
1594
+ update,
1595
+ getIn,
1596
+ hasIn,
1597
+ removeIn,
1598
+ setIn,
1599
+ updateIn,
1600
+ merge,
1601
+ mergeWith,
1602
+ mergeDeep,
1603
+ mergeDeepWith,
1402
1604
  }
1403
1605
 
1404
1606
  export default {
@@ -1427,6 +1629,21 @@ export default {
1427
1629
  isOrdered,
1428
1630
  isRecord,
1429
1631
  isValueObject,
1632
+
1633
+ get,
1634
+ has,
1635
+ remove,
1636
+ set,
1637
+ update,
1638
+ getIn,
1639
+ hasIn,
1640
+ removeIn,
1641
+ setIn,
1642
+ updateIn,
1643
+ merge,
1644
+ mergeWith,
1645
+ mergeDeep,
1646
+ mergeDeepWith,
1430
1647
  }
1431
1648
 
1432
1649
  export type {
@@ -1439,4 +1656,7 @@ export type {
1439
1656
  RecordFactory,
1440
1657
  RecordOf,
1441
1658
  ValueObject,
1659
+
1660
+ $KeyOf,
1661
+ $ValOf,
1442
1662
  }