@@ -101,11 +101,6 @@ declare class _Collection<K, +V> /*implements ValueObject*/ {
101
101
takeWhile(predicate: (value: V, key: K, iter: this) => mixed, context?: mixed): this;
102
102
takeUntil(predicate: (value: V, key: K, iter: this) => mixed, context?: mixed): this;
103
103
104
- filter(
105
- predicate: (value: V, key: K, iter: this) => mixed,
106
- context?: mixed
107
- ): this;
108
-
109
104
filterNot(
110
105
predicate: (value: V, key: K, iter: this) => mixed,
111
106
context?: mixed
@@ -217,6 +212,12 @@ declare class KeyedCollection<K, +V> extends Collection<K, V> {
217
212
concat<KC, VC>(...iters: Array<Iterable<[KC, VC]>>): KeyedCollection<K | KC, V | VC>;
218
213
concat<KC, VC>(...iters: Array<PlainObjInput<KC, VC>>): KeyedCollection<K | KC, V | VC>;
219
214
215
+ filter(predicate: typeof Boolean): KeyedCollection<K, $NonMaybeType<V>>;
216
+ filter(
217
+ predicate: (value: V, key: K, iter: this) => mixed,
218
+ context?: mixed
219
+ ): KeyedCollection<K, V>;
220
+
220
221
map<M>(
221
222
mapper: (value: V, key: K, iter: this) => M,
222
223
context?: mixed
@@ -371,6 +372,12 @@ declare class IndexedCollection<+T> extends Collection<number, T> {
371
372
372
373
concat<C>(...iters: Array<Iterable<C> | C>): IndexedCollection<T | C>;
373
374
375
+ filter(predicate: typeof Boolean): IndexedCollection<$NonMaybeType<T>>;
376
+ filter(
377
+ predicate: (value: T, index: number, iter: this) => mixed,
378
+ context?: mixed
379
+ ): IndexedCollection<T>;
380
+
374
381
map<M>(
375
382
mapper: (value: T, index: number, iter: this) => M,
376
383
context?: mixed
@@ -396,10 +403,16 @@ declare class SetCollection<+T> extends Collection<T, T> {
396
403
397
404
concat<C>(...iters: Array<Iterable<C> | C>): SetCollection<T | C>;
398
405
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.
406
+ // `filter`, `map` and `flatMap` cannot be defined further up the hierarchy,
407
+ // because the implementation for `KeyedCollection` allows the value type to
408
+ // change without constraining the key type. That does not work for
409
+ // `SetCollection` - the value and key types *must* match.
410
+ filter(predicate: typeof Boolean): SetCollection<$NonMaybeType<T>>;
411
+ filter(
412
+ predicate: (value: T, value: T, iter: this) => mixed,
413
+ context?: mixed
414
+ ): SetCollection<T>;
415
+
403
416
map<M>(
404
417
mapper: (value: T, value: T, iter: this) => M,
405
418
context?: mixed
@@ -442,6 +455,12 @@ declare class KeyedSeq<K, +V> extends Seq<K, V> mixins KeyedCollection<K, V> {
442
455
concat<KC, VC>(...iters: Array<Iterable<[KC, VC]>>): KeyedSeq<K | KC, V | VC>;
443
456
concat<KC, VC>(...iters: Array<PlainObjInput<KC, VC>>): KeyedSeq<K | KC, V | VC>;
444
457
458
+ filter(predicate: typeof Boolean): KeyedSeq<K, $NonMaybeType<V>>;
459
+ filter(
460
+ predicate: (value: V, key: K, iter: this) => mixed,
461
+ context?: mixed
462
+ ): KeyedSeq<K, V>;
463
+
445
464
map<M>(
446
465
mapper: (value: V, key: K, iter: this) => M,
447
466
context?: mixed
@@ -475,6 +494,12 @@ declare class IndexedSeq<+T> extends Seq<number, T> mixins IndexedCollection<T>
475
494
476
495
concat<C>(...iters: Array<Iterable<C> | C>): IndexedSeq<T | C>;
477
496
497
+ filter(predicate: typeof Boolean): IndexedSeq<$NonMaybeType<T>>;
498
+ filter(
499
+ predicate: (value: T, index: number, iter: this) => mixed,
500
+ context?: mixed
501
+ ): IndexedSeq<T>;
502
+
478
503
map<M>(
479
504
mapper: (value: T, index: number, iter: this) => M,
480
505
context?: mixed
@@ -596,6 +621,12 @@ declare class SetSeq<+T> extends Seq<T, T> mixins SetCollection<T> {
596
621
597
622
concat<C>(...iters: Array<Iterable<C> | C>): SetSeq<T | C>;
598
623
624
+ filter(predicate: typeof Boolean): SetSeq<$NonMaybeType<T>>;
625
+ filter(
626
+ predicate: (value: T, value: T, iter: this) => mixed,
627
+ context?: mixed
628
+ ): SetSeq<T>;
629
+
599
630
map<M>(
600
631
mapper: (value: T, value: T, iter: this) => M,
601
632
context?: mixed
@@ -663,6 +694,12 @@ declare class List<+T> extends IndexedCollection<T> {
663
694
664
695
concat<C>(...iters: Array<Iterable<C> | C>): List<T | C>;
665
696
697
+ filter(predicate: typeof Boolean): List<$NonMaybeType<T>>;
698
+ filter(
699
+ predicate: (value: T, index: number, iter: this) => mixed,
700
+ context?: mixed
701
+ ): List<T>;
702
+
666
703
map<M>(
667
704
mapper: (value: T, index: number, iter: this) => M,
668
705
context?: mixed
@@ -849,6 +886,12 @@ declare class Map<K, +V> extends KeyedCollection<K, V> {
849
886
concat<KC, VC>(...iters: Array<Iterable<[KC, VC]>>): Map<K | KC, V | VC>;
850
887
concat<KC, VC>(...iters: Array<PlainObjInput<KC, VC>>): Map<K | KC, V | VC>;
851
888
889
+ filter(predicate: typeof Boolean): Map<K, $NonMaybeType<V>>;
890
+ filter(
891
+ predicate: (value: V, key: K, iter: this) => mixed,
892
+ context?: mixed
893
+ ): Map<K, V>;
894
+
852
895
map<M>(
853
896
mapper: (value: V, key: K, iter: this) => M,
854
897
context?: mixed
@@ -944,6 +987,12 @@ declare class OrderedMap<K, +V> extends Map<K, V> {
944
987
concat<KC, VC>(...iters: Array<Iterable<[KC, VC]>>): OrderedMap<K | KC, V | VC>;
945
988
concat<KC, VC>(...iters: Array<PlainObjInput<KC, VC>>): OrderedMap<K | KC, V | VC>;
946
989
990
+ filter(predicate: typeof Boolean): OrderedMap<K, $NonMaybeType<V>>;
991
+ filter(
992
+ predicate: (value: V, key: K, iter: this) => mixed,
993
+ context?: mixed
994
+ ): OrderedMap<K, V>;
995
+
947
996
map<M>(
948
997
mapper: (value: V, key: K, iter: this) => M,
949
998
context?: mixed
@@ -1001,6 +1050,12 @@ declare class Set<+T> extends SetCollection<T> {
1001
1050
1002
1051
concat<C>(...iters: Array<Iterable<C> | C>): Set<T | C>;
1003
1052
1053
+ filter(predicate: typeof Boolean): Set<$NonMaybeType<T>>;
1054
+ filter(
1055
+ predicate: (value: T, value: T, iter: this) => mixed,
1056
+ context?: mixed
1057
+ ): Set<T>;
1058
+
1004
1059
map<M>(
1005
1060
mapper: (value: T, value: T, iter: this) => M,
1006
1061
context?: mixed
@@ -1036,6 +1091,12 @@ declare class OrderedSet<+T> extends Set<T> {
1036
1091
1037
1092
concat<C>(...iters: Array<Iterable<C> | C>): OrderedSet<T | C>;
1038
1093
1094
+ filter(predicate: typeof Boolean): OrderedSet<$NonMaybeType<T>>;
1095
+ filter(
1096
+ predicate: (value: T, value: T, iter: this) => mixed,
1097
+ context?: mixed
1098
+ ): OrderedSet<T>;
1099
+
1039
1100
map<M>(
1040
1101
mapper: (value: T, value: T, iter: this) => M,
1041
1102
context?: mixed
@@ -1177,6 +1238,12 @@ declare class Stack<+T> extends IndexedCollection<T> {
1177
1238
1178
1239
concat<C>(...iters: Array<Iterable<C> | C>): Stack<T | C>;
1179
1240
1241
+ filter(predicate: typeof Boolean): Stack<$NonMaybeType<T>>;
1242
+ filter(
1243
+ predicate: (value: T, index: number, iter: this) => mixed,
1244
+ context?: mixed
1245
+ ): Stack<T>;
1246
+
1180
1247
map<M>(
1181
1248
mapper: (value: T, index: number, iter: this) => M,
1182
1249
context?: mixed
0 commit comments