source: imaps-frontend/node_modules/immutable/dist/immutable.js.flow

main
Last change on this file was 0c6b92a, checked in by stefan toskovski <stefantoska84@…>, 5 weeks ago

Pred finalna verzija

  • Property mode set to 100644
File size: 61.3 KB
Line 
1/**
2 * This file provides type definitions for use with the Flow type checker.
3 *
4 * An important caveat when using these definitions is that the types for
5 * `Collection.Keyed`, `Collection.Indexed`, `Seq.Keyed`, and so on are stubs.
6 * When referring to those types, you can get the proper definitions by
7 * importing the types `KeyedCollection`, `IndexedCollection`, `KeyedSeq`, etc.
8 * For example,
9 *
10 * import { Seq } from 'immutable'
11 * import type { IndexedCollection, IndexedSeq } from 'immutable'
12 *
13 * const someSeq: IndexedSeq<number> = Seq.Indexed.of(1, 2, 3)
14 *
15 * function takesASeq<T, TS: IndexedCollection<T>>(iter: TS): TS {
16 * return iter.butLast()
17 * }
18 *
19 * takesASeq(someSeq)
20 *
21 * @flow strict
22 */
23
24// Helper type that represents plain objects allowed as arguments to
25// some constructors and functions.
26type PlainObjInput<K, V> = { +[key: K]: V, __proto__: null };
27
28type K<T> = $Keys<T>;
29
30// Helper types to extract the "keys" and "values" use by the *In() methods.
31type $KeyOf<C> = $Call<
32 (<K>(?_Collection<K, mixed>) => K) &
33 (<T>(?$ReadOnlyArray<T>) => number) &
34 (<T>(?RecordInstance<T> | T) => $Keys<T>) &
35 (<T: Object>(T) => $Keys<T>),
36 C
37>;
38
39type $ValOf<C, K = $KeyOf<C>> = $Call<
40 (<V>(?_Collection<any, V>) => V) &
41 (<T>(?$ReadOnlyArray<T>) => T) &
42 (<T, K: $Keys<T>>(?RecordInstance<T> | T, K) => $ElementType<T, K>) &
43 (<T: Object>(T) => $Values<T>),
44 C,
45 K
46>;
47
48type $IterableOf<C> = $Call<
49 (<V: Array<any> | IndexedCollection<any> | SetCollection<any>>(
50 V
51 ) => Iterable<$ValOf<V>>) &
52 (<
53 V:
54 | KeyedCollection<any, any>
55 | RecordInstance<any>
56 | PlainObjInput<any, any>
57 >(
58 V
59 ) => Iterable<[$KeyOf<V>, $ValOf<V>]>),
60 C
61>;
62
63const PairSorting: $ReadOnly<{ LeftThenRight: number, RightThenLeft: number }> =
64 {
65 LeftThenRight: -1,
66 RightThenLeft: +1,
67 };
68
69type Comparator<T> = (left: T, right: T) => number;
70
71declare class _Collection<K, +V> implements ValueObject {
72 equals(other: mixed): boolean;
73 hashCode(): number;
74 get(key: K, ..._: []): V | void;
75 get<NSV>(key: K, notSetValue: NSV): V | NSV;
76 has(key: K): boolean;
77 includes(value: V): boolean;
78 contains(value: V): boolean;
79 first(): V | void;
80 first<NSV>(notSetValue: NSV): V | NSV;
81 last(): V | void;
82 last<NSV>(notSetValue: NSV): V | NSV;
83
84 hasIn(keyPath: Iterable<mixed>): boolean;
85
86 getIn(keyPath: [], notSetValue?: mixed): this;
87 getIn<NSV>(keyPath: [K], notSetValue: NSV): V | NSV;
88 getIn<NSV, K2: $KeyOf<V>>(
89 keyPath: [K, K2],
90 notSetValue: NSV
91 ): $ValOf<V, K2> | NSV;
92 getIn<NSV, K2: $KeyOf<V>, K3: $KeyOf<$ValOf<V, K2>>>(
93 keyPath: [K, K2, K3],
94 notSetValue: NSV
95 ): $ValOf<$ValOf<V, K2>, K3> | NSV;
96 getIn<
97 NSV,
98 K2: $KeyOf<V>,
99 K3: $KeyOf<$ValOf<V, K2>>,
100 K4: $KeyOf<$ValOf<$ValOf<V, K2>, K3>>
101 >(
102 keyPath: [K, K2, K3, K4],
103 notSetValue: NSV
104 ): $ValOf<$ValOf<$ValOf<V, K2>, K3>, K4> | NSV;
105 getIn<
106 NSV,
107 K2: $KeyOf<V>,
108 K3: $KeyOf<$ValOf<V, K2>>,
109 K4: $KeyOf<$ValOf<$ValOf<V, K2>, K3>>,
110 K5: $KeyOf<$ValOf<$ValOf<$ValOf<V, K2>, K3>, K4>>
111 >(
112 keyPath: [K, K2, K3, K4, K5],
113 notSetValue: NSV
114 ): $ValOf<$ValOf<$ValOf<$ValOf<V, K2>, K3>, K4>, K5> | NSV;
115
116 update<U>(updater: (value: this) => U): U;
117
118 toJS(): Array<any> | { [key: string]: mixed };
119 toJSON(): Array<V> | { [key: string]: V };
120 toArray(): Array<V> | Array<[K, V]>;
121 toObject(): { [key: string]: V };
122 toMap(): Map<K, V>;
123 toOrderedMap(): OrderedMap<K, V>;
124 toSet(): Set<V>;
125 toOrderedSet(): OrderedSet<V>;
126 toList(): List<V>;
127 toStack(): Stack<V>;
128 toSeq(): Seq<K, V>;
129 toKeyedSeq(): KeyedSeq<K, V>;
130 toIndexedSeq(): IndexedSeq<V>;
131 toSetSeq(): SetSeq<V>;
132
133 keys(): Iterator<K>;
134 values(): Iterator<V>;
135 entries(): Iterator<[K, V]>;
136
137 keySeq(): IndexedSeq<K>;
138 valueSeq(): IndexedSeq<V>;
139 entrySeq(): IndexedSeq<[K, V]>;
140
141 reverse(): this;
142 sort(comparator?: Comparator<V>): this;
143
144 sortBy<C>(
145 comparatorValueMapper: (value: V, key: K, iter: this) => C,
146 comparator?: Comparator<C>
147 ): this;
148
149 groupBy<G>(
150 grouper: (value: V, key: K, iter: this) => G,
151 context?: mixed
152 ): KeyedSeq<G, this>;
153
154 forEach(
155 sideEffect: (value: V, key: K, iter: this) => any,
156 context?: mixed
157 ): number;
158
159 slice(begin?: number, end?: number): this;
160 rest(): this;
161 butLast(): this;
162 skip(amount: number): this;
163 skipLast(amount: number): this;
164 skipWhile(
165 predicate: (value: V, key: K, iter: this) => mixed,
166 context?: mixed
167 ): this;
168 skipUntil(
169 predicate: (value: V, key: K, iter: this) => mixed,
170 context?: mixed
171 ): this;
172 take(amount: number): this;
173 takeLast(amount: number): this;
174 takeWhile(
175 predicate: (value: V, key: K, iter: this) => mixed,
176 context?: mixed
177 ): this;
178 takeUntil(
179 predicate: (value: V, key: K, iter: this) => mixed,
180 context?: mixed
181 ): this;
182
183 filterNot(
184 predicate: (value: V, key: K, iter: this) => mixed,
185 context?: mixed
186 ): this;
187
188 reduce<R>(
189 reducer: (reduction: R, value: V, key: K, iter: this) => R,
190 initialReduction: R,
191 context?: mixed
192 ): R;
193 reduce<R>(reducer: (reduction: V | R, value: V, key: K, iter: this) => R): R;
194
195 reduceRight<R>(
196 reducer: (reduction: R, value: V, key: K, iter: this) => R,
197 initialReduction: R,
198 context?: mixed
199 ): R;
200 reduceRight<R>(
201 reducer: (reduction: V | R, value: V, key: K, iter: this) => R
202 ): R;
203
204 every(
205 predicate: (value: V, key: K, iter: this) => mixed,
206 context?: mixed
207 ): boolean;
208 some(
209 predicate: (value: V, key: K, iter: this) => mixed,
210 context?: mixed
211 ): boolean;
212 join(separator?: string): string;
213 isEmpty(): boolean;
214 count(
215 predicate?: (value: V, key: K, iter: this) => mixed,
216 context?: mixed
217 ): number;
218 countBy<G>(
219 grouper: (value: V, key: K, iter: this) => G,
220 context?: mixed
221 ): Map<G, number>;
222
223 find(
224 predicate: (value: V, key: K, iter: this) => mixed,
225 context?: mixed,
226 notSetValue?: V
227 ): V | void;
228 findLast(
229 predicate: (value: V, key: K, iter: this) => mixed,
230 context?: mixed,
231 notSetValue?: V
232 ): V | void;
233
234 findEntry(predicate: (value: V, key: K, iter: this) => mixed): [K, V] | void;
235 findLastEntry(
236 predicate: (value: V, key: K, iter: this) => mixed
237 ): [K, V] | void;
238
239 findKey(
240 predicate: (value: V, key: K, iter: this) => mixed,
241 context?: mixed
242 ): K | void;
243 findLastKey(
244 predicate: (value: V, key: K, iter: this) => mixed,
245 context?: mixed
246 ): K | void;
247
248 keyOf(searchValue: V): K | void;
249 lastKeyOf(searchValue: V): K | void;
250
251 max(comparator?: Comparator<V>): V;
252 maxBy<C>(
253 comparatorValueMapper: (value: V, key: K, iter: this) => C,
254 comparator?: Comparator<C>
255 ): V;
256 min(comparator?: Comparator<V>): V;
257 minBy<C>(
258 comparatorValueMapper: (value: V, key: K, iter: this) => C,
259 comparator?: Comparator<C>
260 ): V;
261
262 isSubset(iter: Iterable<V>): boolean;
263 isSuperset(iter: Iterable<V>): boolean;
264}
265
266declare function isImmutable(
267 maybeImmutable: mixed
268): boolean %checks(maybeImmutable instanceof Collection);
269declare function isCollection(
270 maybeCollection: mixed
271): boolean %checks(maybeCollection instanceof Collection);
272declare function isKeyed(
273 maybeKeyed: mixed
274): boolean %checks(maybeKeyed instanceof KeyedCollection);
275declare function isIndexed(
276 maybeIndexed: mixed
277): boolean %checks(maybeIndexed instanceof IndexedCollection);
278declare function isAssociative(
279 maybeAssociative: mixed
280): boolean %checks(maybeAssociative instanceof KeyedCollection ||
281 maybeAssociative instanceof IndexedCollection);
282declare function isOrdered(
283 maybeOrdered: mixed
284): boolean %checks(maybeOrdered instanceof IndexedCollection ||
285 maybeOrdered instanceof OrderedMap ||
286 maybeOrdered instanceof OrderedSet);
287declare function isValueObject(maybeValue: mixed): boolean;
288
289declare function isSeq(maybeSeq: any): boolean %checks(maybeSeq instanceof Seq);
290declare function isList(maybeList: any): boolean %checks(maybeList instanceof
291 List);
292declare function isMap(maybeMap: any): boolean %checks(maybeMap instanceof Map);
293declare function isOrderedMap(
294 maybeOrderedMap: any
295): boolean %checks(maybeOrderedMap instanceof OrderedMap);
296declare function isStack(maybeStack: any): boolean %checks(maybeStack instanceof
297 Stack);
298declare function isSet(maybeSet: any): boolean %checks(maybeSet instanceof Set);
299declare function isOrderedSet(
300 maybeOrderedSet: any
301): boolean %checks(maybeOrderedSet instanceof OrderedSet);
302declare function isRecord(
303 maybeRecord: any
304): boolean %checks(maybeRecord instanceof Record);
305
306declare interface ValueObject {
307 equals(other: mixed): boolean;
308 hashCode(): number;
309}
310
311declare class Collection<K, +V> extends _Collection<K, V> {
312 static Keyed: typeof KeyedCollection;
313 static Indexed: typeof IndexedCollection;
314 static Set: typeof SetCollection;
315
316 static isCollection: typeof isCollection;
317 static isKeyed: typeof isKeyed;
318 static isIndexed: typeof isIndexed;
319 static isAssociative: typeof isAssociative;
320 static isOrdered: typeof isOrdered;
321}
322
323declare class KeyedCollection<K, +V> extends Collection<K, V> {
324 static <K, V>(
325 values?: Iterable<[K, V]> | PlainObjInput<K, V>
326 ): KeyedCollection<K, V>;
327
328 toJS(): { [key: string]: mixed };
329 toJSON(): { [key: string]: V };
330 toArray(): Array<[K, V]>;
331 @@iterator(): Iterator<[K, V]>;
332 toSeq(): KeyedSeq<K, V>;
333 flip(): KeyedCollection<V, K>;
334
335 concat<KC, VC>(
336 ...iters: Array<Iterable<[KC, VC]> | PlainObjInput<KC, VC>>
337 ): KeyedCollection<K | KC, V | VC>;
338
339 filter(predicate: typeof Boolean): KeyedCollection<K, $NonMaybeType<V>>;
340 filter(
341 predicate: (value: V, key: K, iter: this) => mixed,
342 context?: mixed
343 ): KeyedCollection<K, V>;
344
345 partition(
346 predicate: (value: V, key: K, iter: this) => mixed,
347 context?: mixed
348 ): [this, this];
349
350 map<M>(
351 mapper: (value: V, key: K, iter: this) => M,
352 context?: mixed
353 ): KeyedCollection<K, M>;
354
355 mapKeys<M>(
356 mapper: (key: K, value: V, iter: this) => M,
357 context?: mixed
358 ): KeyedCollection<M, V>;
359
360 mapEntries<KM, VM>(
361 mapper: (entry: [K, V], index: number, iter: this) => [KM, VM],
362 context?: mixed
363 ): KeyedCollection<KM, VM>;
364
365 flatMap<KM, VM>(
366 mapper: (value: V, key: K, iter: this) => Iterable<[KM, VM]>,
367 context?: mixed
368 ): KeyedCollection<KM, VM>;
369
370 flatten(depth?: number): KeyedCollection<any, any>;
371 flatten(shallow?: boolean): KeyedCollection<any, any>;
372}
373
374Collection.Keyed = KeyedCollection;
375
376declare class IndexedCollection<+T> extends Collection<number, T> {
377 static <T>(iter?: Iterable<T>): IndexedCollection<T>;
378
379 toJS(): Array<mixed>;
380 toJSON(): Array<T>;
381 toArray(): Array<T>;
382 @@iterator(): Iterator<T>;
383 toSeq(): IndexedSeq<T>;
384 fromEntrySeq<K, V>(): KeyedSeq<K, V>;
385 interpose(separator: T): this;
386 interleave(...collections: Iterable<T>[]): this;
387 splice(index: number, removeNum: number, ...values: T[]): this;
388
389 zip<A>(a: Iterable<A>, ..._: []): IndexedCollection<[T, A]>;
390 zip<A, B>(
391 a: Iterable<A>,
392 b: Iterable<B>,
393 ..._: []
394 ): IndexedCollection<[T, A, B]>;
395 zip<A, B, C>(
396 a: Iterable<A>,
397 b: Iterable<B>,
398 c: Iterable<C>,
399 ..._: []
400 ): IndexedCollection<[T, A, B, C]>;
401 zip<A, B, C, D>(
402 a: Iterable<A>,
403 b: Iterable<B>,
404 c: Iterable<C>,
405 d: Iterable<D>,
406 ..._: []
407 ): IndexedCollection<[T, A, B, C, D]>;
408 zip<A, B, C, D, E>(
409 a: Iterable<A>,
410 b: Iterable<B>,
411 c: Iterable<C>,
412 d: Iterable<D>,
413 e: Iterable<E>,
414 ..._: []
415 ): IndexedCollection<[T, A, B, C, D, E]>;
416
417 zipAll<A>(a: Iterable<A>, ..._: []): IndexedCollection<[T | void, A | void]>;
418 zipAll<A, B>(
419 a: Iterable<A>,
420 b: Iterable<B>,
421 ..._: []
422 ): IndexedCollection<[T | void, A | void, B | void]>;
423 zipAll<A, B, C>(
424 a: Iterable<A>,
425 b: Iterable<B>,
426 c: Iterable<C>,
427 ..._: []
428 ): IndexedCollection<[T | void, A | void, B | void, C | void]>;
429 zipAll<A, B, C, D>(
430 a: Iterable<A>,
431 b: Iterable<B>,
432 c: Iterable<C>,
433 d: Iterable<D>,
434 ..._: []
435 ): IndexedCollection<[T | void, A | void, B | void, C | void, D | void]>;
436 zipAll<A, B, C, D, E>(
437 a: Iterable<A>,
438 b: Iterable<B>,
439 c: Iterable<C>,
440 d: Iterable<D>,
441 e: Iterable<E>,
442 ..._: []
443 ): IndexedCollection<
444 [T | void, A | void, B | void, C | void, D | void, E | void]
445 >;
446
447 zipWith<A, R>(
448 zipper: (value: T, a: A) => R,
449 a: Iterable<A>,
450 ..._: []
451 ): IndexedCollection<R>;
452 zipWith<A, B, R>(
453 zipper: (value: T, a: A, b: B) => R,
454 a: Iterable<A>,
455 b: Iterable<B>,
456 ..._: []
457 ): IndexedCollection<R>;
458 zipWith<A, B, C, R>(
459 zipper: (value: T, a: A, b: B, c: C) => R,
460 a: Iterable<A>,
461 b: Iterable<B>,
462 c: Iterable<C>,
463 ..._: []
464 ): IndexedCollection<R>;
465 zipWith<A, B, C, D, R>(
466 zipper: (value: T, a: A, b: B, c: C, d: D) => R,
467 a: Iterable<A>,
468 b: Iterable<B>,
469 c: Iterable<C>,
470 d: Iterable<D>,
471 ..._: []
472 ): IndexedCollection<R>;
473 zipWith<A, B, C, D, E, R>(
474 zipper: (value: T, a: A, b: B, c: C, d: D, e: E) => R,
475 a: Iterable<A>,
476 b: Iterable<B>,
477 c: Iterable<C>,
478 d: Iterable<D>,
479 e: Iterable<E>,
480 ..._: []
481 ): IndexedCollection<R>;
482
483 indexOf(searchValue: T): number;
484 lastIndexOf(searchValue: T): number;
485 findIndex(
486 predicate: (value: T, index: number, iter: this) => mixed,
487 context?: mixed
488 ): number;
489 findLastIndex(
490 predicate: (value: T, index: number, iter: this) => mixed,
491 context?: mixed
492 ): number;
493
494 concat<C>(...iters: Array<Iterable<C> | C>): IndexedCollection<T | C>;
495
496 filter(predicate: typeof Boolean): IndexedCollection<$NonMaybeType<T>>;
497 filter(
498 predicate: (value: T, index: number, iter: this) => mixed,
499 context?: mixed
500 ): IndexedCollection<T>;
501
502 partition(
503 predicate: (value: T, index: number, iter: this) => mixed,
504 context?: mixed
505 ): [this, this];
506
507 map<M>(
508 mapper: (value: T, index: number, iter: this) => M,
509 context?: mixed
510 ): IndexedCollection<M>;
511
512 flatMap<M>(
513 mapper: (value: T, index: number, iter: this) => Iterable<M>,
514 context?: mixed
515 ): IndexedCollection<M>;
516
517 flatten(depth?: number): IndexedCollection<any>;
518 flatten(shallow?: boolean): IndexedCollection<any>;
519}
520
521declare class SetCollection<+T> extends Collection<T, T> {
522 static <T>(iter?: Iterable<T>): SetCollection<T>;
523
524 toJS(): Array<mixed>;
525 toJSON(): Array<T>;
526 toArray(): Array<T>;
527 @@iterator(): Iterator<T>;
528 toSeq(): SetSeq<T>;
529
530 concat<U>(...collections: Iterable<U>[]): SetCollection<T | U>;
531
532 // `filter`, `map` and `flatMap` cannot be defined further up the hierarchy,
533 // because the implementation for `KeyedCollection` allows the value type to
534 // change without constraining the key type. That does not work for
535 // `SetCollection` - the value and key types *must* match.
536 filter(predicate: typeof Boolean): SetCollection<$NonMaybeType<T>>;
537 filter(
538 predicate: (value: T, value: T, iter: this) => mixed,
539 context?: mixed
540 ): SetCollection<T>;
541
542 partition(
543 predicate: (value: T, value: T, iter: this) => mixed,
544 context?: mixed
545 ): [this, this];
546
547 map<M>(
548 mapper: (value: T, value: T, iter: this) => M,
549 context?: mixed
550 ): SetCollection<M>;
551
552 flatMap<M>(
553 mapper: (value: T, value: T, iter: this) => Iterable<M>,
554 context?: mixed
555 ): SetCollection<M>;
556
557 flatten(depth?: number): SetCollection<any>;
558 flatten(shallow?: boolean): SetCollection<any>;
559}
560
561declare function isSeq(maybeSeq: mixed): boolean %checks(maybeSeq instanceof
562 Seq);
563declare class Seq<K, +V> extends _Collection<K, V> {
564 static Keyed: typeof KeyedSeq;
565 static Indexed: typeof IndexedSeq;
566 static Set: typeof SetSeq;
567
568 static <K, V>(values: KeyedSeq<K, V>): KeyedSeq<K, V>;
569 static <T>(values: SetSeq<T>): SetSeq<K, V>;
570 static <T>(values: Iterable<T>): IndexedSeq<T>;
571 static <K, V>(values?: PlainObjInput<K, V>): KeyedSeq<K, V>;
572
573 static isSeq: typeof isSeq;
574
575 size: number | void;
576 cacheResult(): this;
577 toSeq(): this;
578}
579
580declare class KeyedSeq<K, +V> extends Seq<K, V> mixins KeyedCollection<K, V> {
581 static <K, V>(
582 values?: Iterable<[K, V]> | PlainObjInput<K, V>
583 ): KeyedSeq<K, V>;
584
585 // Override specialized return types
586 flip(): KeyedSeq<V, K>;
587
588 concat<KC, VC>(
589 ...iters: Array<Iterable<[KC, VC]> | PlainObjInput<KC, VC>>
590 ): KeyedSeq<K | KC, V | VC>;
591
592 filter(predicate: typeof Boolean): KeyedSeq<K, $NonMaybeType<V>>;
593 filter(
594 predicate: (value: V, key: K, iter: this) => mixed,
595 context?: mixed
596 ): KeyedSeq<K, V>;
597
598 partition(
599 predicate: (value: V, key: K, iter: this) => mixed,
600 context?: mixed
601 ): [this, this];
602
603 map<M>(
604 mapper: (value: V, key: K, iter: this) => M,
605 context?: mixed
606 ): KeyedSeq<K, M>;
607
608 mapKeys<M>(
609 mapper: (key: K, value: V, iter: this) => M,
610 context?: mixed
611 ): KeyedSeq<M, V>;
612
613 mapEntries<KM, VM>(
614 mapper: (entry: [K, V], index: number, iter: this) => [KM, VM],
615 context?: mixed
616 ): KeyedSeq<KM, VM>;
617
618 flatMap<KM, VM>(
619 mapper: (value: V, key: K, iter: this) => Iterable<[KM, VM]>,
620 context?: mixed
621 ): KeyedSeq<KM, VM>;
622
623 flatten(depth?: number): KeyedSeq<any, any>;
624 flatten(shallow?: boolean): KeyedSeq<any, any>;
625}
626
627declare class IndexedSeq<+T>
628 extends Seq<number, T>
629 mixins IndexedCollection<T>
630{
631 static <T>(values?: Iterable<T>): IndexedSeq<T>;
632
633 static of<T>(...values: T[]): IndexedSeq<T>;
634
635 // Override specialized return types
636
637 concat<C>(...iters: Array<Iterable<C> | C>): IndexedSeq<T | C>;
638
639 filter(predicate: typeof Boolean): IndexedSeq<$NonMaybeType<T>>;
640 filter(
641 predicate: (value: T, index: number, iter: this) => mixed,
642 context?: mixed
643 ): IndexedSeq<T>;
644
645 partition(
646 predicate: (value: T, index: number, iter: this) => mixed,
647 context?: mixed
648 ): [this, this];
649
650 map<M>(
651 mapper: (value: T, index: number, iter: this) => M,
652 context?: mixed
653 ): IndexedSeq<M>;
654
655 flatMap<M>(
656 mapper: (value: T, index: number, iter: this) => Iterable<M>,
657 context?: mixed
658 ): IndexedSeq<M>;
659
660 flatten(depth?: number): IndexedSeq<any>;
661 flatten(shallow?: boolean): IndexedSeq<any>;
662
663 zip<A>(a: Iterable<A>, ..._: []): IndexedSeq<[T, A]>;
664 zip<A, B>(a: Iterable<A>, b: Iterable<B>, ..._: []): IndexedSeq<[T, A, B]>;
665 zip<A, B, C>(
666 a: Iterable<A>,
667 b: Iterable<B>,
668 c: Iterable<C>,
669 ..._: []
670 ): IndexedSeq<[T, A, B, C]>;
671 zip<A, B, C, D>(
672 a: Iterable<A>,
673 b: Iterable<B>,
674 c: Iterable<C>,
675 d: Iterable<D>,
676 ..._: []
677 ): IndexedSeq<[T, A, B, C, D]>;
678 zip<A, B, C, D, E>(
679 a: Iterable<A>,
680 b: Iterable<B>,
681 c: Iterable<C>,
682 d: Iterable<D>,
683 e: Iterable<E>,
684 ..._: []
685 ): IndexedSeq<[T, A, B, C, D, E]>;
686
687 zipAll<A>(a: Iterable<A>, ..._: []): IndexedSeq<[T | void, A | void]>;
688 zipAll<A, B>(
689 a: Iterable<A>,
690 b: Iterable<B>,
691 ..._: []
692 ): IndexedSeq<[T | void, A | void, B | void]>;
693 zipAll<A, B, C>(
694 a: Iterable<A>,
695 b: Iterable<B>,
696 c: Iterable<C>,
697 ..._: []
698 ): IndexedSeq<[T | void, A | void, B | void, C | void]>;
699 zipAll<A, B, C, D>(
700 a: Iterable<A>,
701 b: Iterable<B>,
702 c: Iterable<C>,
703 d: Iterable<D>,
704 ..._: []
705 ): IndexedSeq<[T | void, A | void, B | void, C | void, D | void]>;
706 zipAll<A, B, C, D, E>(
707 a: Iterable<A>,
708 b: Iterable<B>,
709 c: Iterable<C>,
710 d: Iterable<D>,
711 e: Iterable<E>,
712 ..._: []
713 ): IndexedSeq<[T | void, A | void, B | void, C | void, D | void, E | void]>;
714
715 zipWith<A, R>(
716 zipper: (value: T, a: A) => R,
717 a: Iterable<A>,
718 ..._: []
719 ): IndexedSeq<R>;
720 zipWith<A, B, R>(
721 zipper: (value: T, a: A, b: B) => R,
722 a: Iterable<A>,
723 b: Iterable<B>,
724 ..._: []
725 ): IndexedSeq<R>;
726 zipWith<A, B, C, R>(
727 zipper: (value: T, a: A, b: B, c: C) => R,
728 a: Iterable<A>,
729 b: Iterable<B>,
730 c: Iterable<C>,
731 ..._: []
732 ): IndexedSeq<R>;
733 zipWith<A, B, C, D, R>(
734 zipper: (value: T, a: A, b: B, c: C, d: D) => R,
735 a: Iterable<A>,
736 b: Iterable<B>,
737 c: Iterable<C>,
738 d: Iterable<D>,
739 ..._: []
740 ): IndexedSeq<R>;
741 zipWith<A, B, C, D, E, R>(
742 zipper: (value: T, a: A, b: B, c: C, d: D, e: E) => R,
743 a: Iterable<A>,
744 b: Iterable<B>,
745 c: Iterable<C>,
746 d: Iterable<D>,
747 e: Iterable<E>,
748 ..._: []
749 ): IndexedSeq<R>;
750}
751
752declare class SetSeq<+T> extends Seq<T, T> mixins SetCollection<T> {
753 static <T>(values?: Iterable<T>): SetSeq<T>;
754
755 static of<T>(...values: T[]): SetSeq<T>;
756
757 // Override specialized return types
758
759 concat<U>(...collections: Iterable<U>[]): SetSeq<T | U>;
760
761 filter(predicate: typeof Boolean): SetSeq<$NonMaybeType<T>>;
762 filter(
763 predicate: (value: T, value: T, iter: this) => mixed,
764 context?: mixed
765 ): SetSeq<T>;
766
767 partition(
768 predicate: (value: T, value: T, iter: this) => mixed,
769 context?: mixed
770 ): [this, this];
771
772 map<M>(
773 mapper: (value: T, value: T, iter: this) => M,
774 context?: mixed
775 ): SetSeq<M>;
776
777 flatMap<M>(
778 mapper: (value: T, value: T, iter: this) => Iterable<M>,
779 context?: mixed
780 ): SetSeq<M>;
781
782 flatten(depth?: number): SetSeq<any>;
783 flatten(shallow?: boolean): SetSeq<any>;
784}
785
786declare class UpdatableInCollection<K, +V> {
787 setIn<S>(keyPath: [], value: S): S;
788 setIn(keyPath: [K], value: V): this;
789 setIn<K2: $KeyOf<V>, S: $ValOf<V, K2>>(keyPath: [K, K2], value: S): this;
790 setIn<K2: $KeyOf<V>, K3: $KeyOf<$ValOf<V, K2>>, S: $ValOf<$ValOf<V, K2>, K3>>(
791 keyPath: [K, K2, K3],
792 value: S
793 ): this;
794 setIn<
795 K2: $KeyOf<V>,
796 K3: $KeyOf<$ValOf<V, K2>>,
797 K4: $KeyOf<$ValOf<$ValOf<V, K2>, K3>>,
798 S: $ValOf<$ValOf<$ValOf<V, K2>, K3>, K4>
799 >(
800 keyPath: [K, K2, K3, K4],
801 value: S
802 ): this;
803 setIn<
804 K2: $KeyOf<V>,
805 K3: $KeyOf<$ValOf<V, K2>>,
806 K4: $KeyOf<$ValOf<$ValOf<V, K2>, K3>>,
807 K5: $KeyOf<$ValOf<$ValOf<$ValOf<V, K2>, K3>, K4>>,
808 S: $ValOf<$ValOf<$ValOf<$ValOf<V, K2>, K3>, K4>, K5>
809 >(
810 keyPath: [K, K2, K3, K4, K5],
811 value: S
812 ): this;
813
814 deleteIn(keyPath: []): void;
815 deleteIn(keyPath: [K]): this;
816 deleteIn<K2: $KeyOf<V>>(keyPath: [K, K2]): this;
817 deleteIn<K2: $KeyOf<V>, K3: $KeyOf<$ValOf<V, K2>>>(
818 keyPath: [K, K2, K3]
819 ): this;
820 deleteIn<
821 K2: $KeyOf<V>,
822 K3: $KeyOf<$ValOf<V, K2>>,
823 K4: $KeyOf<$ValOf<$ValOf<V, K2>, K3>>
824 >(
825 keyPath: [K, K2, K3, K4]
826 ): this;
827 deleteIn<
828 K2: $KeyOf<V>,
829 K3: $KeyOf<$ValOf<V, K2>>,
830 K4: $KeyOf<$ValOf<$ValOf<V, K2>, K3>>,
831 K5: $KeyOf<$ValOf<$ValOf<$ValOf<V, K2>, K3>, K4>>
832 >(
833 keyPath: [K, K2, K3, K4, K5]
834 ): this;
835
836 removeIn(keyPath: []): void;
837 removeIn(keyPath: [K]): this;
838 removeIn<K2: $KeyOf<V>>(keyPath: [K, K2]): this;
839 removeIn<K2: $KeyOf<V>, K3: $KeyOf<$ValOf<V, K2>>>(
840 keyPath: [K, K2, K3]
841 ): this;
842 removeIn<
843 K2: $KeyOf<V>,
844 K3: $KeyOf<$ValOf<V, K2>>,
845 K4: $KeyOf<$ValOf<$ValOf<V, K2>, K3>>
846 >(
847 keyPath: [K, K2, K3, K4]
848 ): this;
849 removeIn<
850 K2: $KeyOf<V>,
851 K3: $KeyOf<$ValOf<V, K2>>,
852 K4: $KeyOf<$ValOf<$ValOf<V, K2>, K3>>,
853 K5: $KeyOf<$ValOf<$ValOf<$ValOf<V, K2>, K3>, K4>>
854 >(
855 keyPath: [K, K2, K3, K4, K5]
856 ): this;
857
858 updateIn<U>(keyPath: [], notSetValue: mixed, updater: (value: this) => U): U;
859 updateIn<U>(keyPath: [], updater: (value: this) => U): U;
860 updateIn<NSV>(keyPath: [K], notSetValue: NSV, updater: (value: V) => V): this;
861 updateIn(keyPath: [K], updater: (value: V) => V): this;
862 updateIn<NSV, K2: $KeyOf<V>, S: $ValOf<V, K2>>(
863 keyPath: [K, K2],
864 notSetValue: NSV,
865 updater: (value: $ValOf<V, K2> | NSV) => S
866 ): this;
867 updateIn<K2: $KeyOf<V>, S: $ValOf<V, K2>>(
868 keyPath: [K, K2],
869 updater: (value: $ValOf<V, K2>) => S
870 ): this;
871 updateIn<
872 NSV,
873 K2: $KeyOf<V>,
874 K3: $KeyOf<$ValOf<V, K2>>,
875 S: $ValOf<$ValOf<V, K2>, K3>
876 >(
877 keyPath: [K, K2, K3],
878 notSetValue: NSV,
879 updater: (value: $ValOf<$ValOf<V, K2>, K3> | NSV) => S
880 ): this;
881 updateIn<
882 K2: $KeyOf<V>,
883 K3: $KeyOf<$ValOf<V, K2>>,
884 S: $ValOf<$ValOf<V, K2>, K3>
885 >(
886 keyPath: [K, K2, K3],
887 updater: (value: $ValOf<$ValOf<V, K2>, K3>) => S
888 ): this;
889 updateIn<
890 NSV,
891 K2: $KeyOf<V>,
892 K3: $KeyOf<$ValOf<V, K2>>,
893 K4: $KeyOf<$ValOf<$ValOf<V, K2>, K3>>,
894 S: $ValOf<$ValOf<$ValOf<V, K2>, K3>, K4>
895 >(
896 keyPath: [K, K2, K3, K4],
897 notSetValue: NSV,
898 updater: (value: $ValOf<$ValOf<$ValOf<V, K2>, K3>, K4> | NSV) => S
899 ): this;
900 updateIn<
901 K2: $KeyOf<V>,
902 K3: $KeyOf<$ValOf<V, K2>>,
903 K4: $KeyOf<$ValOf<$ValOf<V, K2>, K3>>,
904 S: $ValOf<$ValOf<$ValOf<V, K2>, K3>, K4>
905 >(
906 keyPath: [K, K2, K3, K4],
907 updater: (value: $ValOf<$ValOf<$ValOf<V, K2>, K3>, K4>) => S
908 ): this;
909 updateIn<
910 NSV,
911 K2: $KeyOf<V>,
912 K3: $KeyOf<$ValOf<V, K2>>,
913 K4: $KeyOf<$ValOf<$ValOf<V, K2>, K3>>,
914 K5: $KeyOf<$ValOf<$ValOf<$ValOf<V, K2>, K3>, K4>>,
915 S: $ValOf<$ValOf<$ValOf<$ValOf<V, K2>, K3>, K4>, K5>
916 >(
917 keyPath: [K, K2, K3, K4, K5],
918 notSetValue: NSV,
919 updater: (
920 value: $ValOf<$ValOf<$ValOf<$ValOf<V, K2>, K3>, K4>, K5> | NSV
921 ) => S
922 ): this;
923 updateIn<
924 K2: $KeyOf<V>,
925 K3: $KeyOf<$ValOf<V, K2>>,
926 K4: $KeyOf<$ValOf<$ValOf<V, K2>, K3>>,
927 K5: $KeyOf<$ValOf<$ValOf<$ValOf<V, K2>, K3>, K4>>,
928 S: $ValOf<$ValOf<$ValOf<$ValOf<V, K2>, K3>, K4>, K5>
929 >(
930 keyPath: [K, K2, K3, K4, K5],
931 updater: (value: $ValOf<$ValOf<$ValOf<$ValOf<V, K2>, K3>, K4>, K5>) => S
932 ): this;
933}
934
935declare function isList(maybeList: mixed): boolean %checks(maybeList instanceof
936 List);
937declare class List<+T>
938 extends IndexedCollection<T>
939 mixins UpdatableInCollection<number, T>
940{
941 static <T>(collection?: Iterable<T>): List<T>;
942
943 static of<T>(...values: T[]): List<T>;
944
945 static isList: typeof isList;
946
947 size: number;
948
949 set<U>(index: number, value: U): List<T | U>;
950 delete(index: number): this;
951 remove(index: number): this;
952 insert<U>(index: number, value: U): List<T | U>;
953 clear(): this;
954 push<U>(...values: U[]): List<T | U>;
955 pop(): this;
956 unshift<U>(...values: U[]): List<T | U>;
957 shift(): this;
958
959 update<U>(updater: (value: this) => U): U;
960 update<U>(index: number, updater: (value: T) => U): List<T | U>;
961 update<U>(
962 index: number,
963 notSetValue: U,
964 updater: (value: T) => U
965 ): List<T | U>;
966
967 merge<U>(...collections: Iterable<U>[]): List<T | U>;
968
969 setSize(size: number): this;
970
971 mergeIn(keyPath: Iterable<mixed>, ...collections: Iterable<mixed>[]): this;
972 mergeDeepIn(
973 keyPath: Iterable<mixed>,
974 ...collections: Iterable<mixed>[]
975 ): this;
976
977 withMutations(mutator: (mutable: this) => mixed): this;
978 asMutable(): this;
979 wasAltered(): boolean;
980 asImmutable(): this;
981
982 // Override specialized return types
983
984 concat<C>(...iters: Array<Iterable<C> | C>): List<T | C>;
985
986 filter(predicate: typeof Boolean): List<$NonMaybeType<T>>;
987 filter(
988 predicate: (value: T, index: number, iter: this) => mixed,
989 context?: mixed
990 ): List<T>;
991
992 partition(
993 predicate: (value: T, index: number, iter: this) => mixed,
994 context?: mixed
995 ): [this, this];
996
997 map<M>(
998 mapper: (value: T, index: number, iter: this) => M,
999 context?: mixed
1000 ): List<M>;
1001
1002 flatMap<M>(
1003 mapper: (value: T, index: number, iter: this) => Iterable<M>,
1004 context?: mixed
1005 ): List<M>;
1006
1007 flatten(depth?: number): List<any>;
1008 flatten(shallow?: boolean): List<any>;
1009
1010 zip<A>(a: Iterable<A>, ..._: []): List<[T, A]>;
1011 zip<A, B>(a: Iterable<A>, b: Iterable<B>, ..._: []): List<[T, A, B]>;
1012 zip<A, B, C>(
1013 a: Iterable<A>,
1014 b: Iterable<B>,
1015 c: Iterable<C>,
1016 ..._: []
1017 ): List<[T, A, B, C]>;
1018 zip<A, B, C, D>(
1019 a: Iterable<A>,
1020 b: Iterable<B>,
1021 c: Iterable<C>,
1022 d: Iterable<D>,
1023 ..._: []
1024 ): List<[T, A, B, C, D]>;
1025 zip<A, B, C, D, E>(
1026 a: Iterable<A>,
1027 b: Iterable<B>,
1028 c: Iterable<C>,
1029 d: Iterable<D>,
1030 e: Iterable<E>,
1031 ..._: []
1032 ): List<[T, A, B, C, D, E]>;
1033
1034 zipAll<A>(a: Iterable<A>, ..._: []): List<[T | void, A | void]>;
1035 zipAll<A, B>(
1036 a: Iterable<A>,
1037 b: Iterable<B>,
1038 ..._: []
1039 ): List<[T | void, A | void, B | void]>;
1040 zipAll<A, B, C>(
1041 a: Iterable<A>,
1042 b: Iterable<B>,
1043 c: Iterable<C>,
1044 ..._: []
1045 ): List<[T | void, A | void, B | void, C | void]>;
1046 zipAll<A, B, C, D>(
1047 a: Iterable<A>,
1048 b: Iterable<B>,
1049 c: Iterable<C>,
1050 d: Iterable<D>,
1051 ..._: []
1052 ): List<[T | void, A | void, B | void, C | void, D | void]>;
1053 zipAll<A, B, C, D, E>(
1054 a: Iterable<A>,
1055 b: Iterable<B>,
1056 c: Iterable<C>,
1057 d: Iterable<D>,
1058 e: Iterable<E>,
1059 ..._: []
1060 ): List<[T | void, A | void, B | void, C | void, D | void, E | void]>;
1061
1062 zipWith<A, R>(
1063 zipper: (value: T, a: A) => R,
1064 a: Iterable<A>,
1065 ..._: []
1066 ): List<R>;
1067 zipWith<A, B, R>(
1068 zipper: (value: T, a: A, b: B) => R,
1069 a: Iterable<A>,
1070 b: Iterable<B>,
1071 ..._: []
1072 ): List<R>;
1073 zipWith<A, B, C, R>(
1074 zipper: (value: T, a: A, b: B, c: C) => R,
1075 a: Iterable<A>,
1076 b: Iterable<B>,
1077 c: Iterable<C>,
1078 ..._: []
1079 ): List<R>;
1080 zipWith<A, B, C, D, R>(
1081 zipper: (value: T, a: A, b: B, c: C, d: D) => R,
1082 a: Iterable<A>,
1083 b: Iterable<B>,
1084 c: Iterable<C>,
1085 d: Iterable<D>,
1086 ..._: []
1087 ): List<R>;
1088 zipWith<A, B, C, D, E, R>(
1089 zipper: (value: T, a: A, b: B, c: C, d: D, e: E) => R,
1090 a: Iterable<A>,
1091 b: Iterable<B>,
1092 c: Iterable<C>,
1093 d: Iterable<D>,
1094 e: Iterable<E>,
1095 ..._: []
1096 ): List<R>;
1097}
1098
1099declare function isMap(maybeMap: mixed): boolean %checks(maybeMap instanceof
1100 Map);
1101declare class Map<K, +V>
1102 extends KeyedCollection<K, V>
1103 mixins UpdatableInCollection<K, V>
1104{
1105 static <K, V>(values?: Iterable<[K, V]> | PlainObjInput<K, V>): Map<K, V>;
1106
1107 static isMap: typeof isMap;
1108
1109 size: number;
1110
1111 set<K_, V_>(key: K_, value: V_): Map<K | K_, V | V_>;
1112 delete(key: K): this;
1113 remove(key: K): this;
1114 clear(): this;
1115
1116 deleteAll(keys: Iterable<K>): Map<K, V>;
1117 removeAll(keys: Iterable<K>): Map<K, V>;
1118
1119 update<U>(updater: (value: this) => U): U;
1120 update<V_>(key: K, updater: (value: V) => V_): Map<K, V | V_>;
1121 update<V_>(
1122 key: K,
1123 notSetValue: V_,
1124 updater: (value: V) => V_
1125 ): Map<K, V | V_>;
1126
1127 merge<K_, V_>(
1128 ...collections: (Iterable<[K_, V_]> | PlainObjInput<K_, V_>)[]
1129 ): Map<K | K_, V | V_>;
1130 concat<K_, V_>(
1131 ...collections: (Iterable<[K_, V_]> | PlainObjInput<K_, V_>)[]
1132 ): Map<K | K_, V | V_>;
1133
1134 mergeWith<K_, W, X>(
1135 merger: (oldVal: V, newVal: W, key: K) => X,
1136 ...collections: (Iterable<[K_, W]> | PlainObjInput<K_, W>)[]
1137 ): Map<K | K_, V | W | X>;
1138
1139 mergeDeep<K_, V_>(
1140 ...collections: (Iterable<[K_, V_]> | PlainObjInput<K_, V_>)[]
1141 ): Map<K | K_, V | V_>;
1142
1143 mergeDeepWith<K_, V_>(
1144 merger: (oldVal: any, newVal: any, key: any) => mixed,
1145 ...collections: (Iterable<[K_, V_]> | PlainObjInput<K_, V_>)[]
1146 ): Map<K | K_, V | V_>;
1147
1148 mergeIn(
1149 keyPath: Iterable<mixed>,
1150 ...collections: (Iterable<mixed> | PlainObjInput<mixed, mixed>)[]
1151 ): this;
1152 mergeDeepIn(
1153 keyPath: Iterable<mixed>,
1154 ...collections: (Iterable<mixed> | PlainObjInput<mixed, mixed>)[]
1155 ): this;
1156
1157 withMutations(mutator: (mutable: this) => mixed): this;
1158 asMutable(): this;
1159 wasAltered(): boolean;
1160 asImmutable(): this;
1161
1162 // Override specialized return types
1163
1164 flip(): Map<V, K>;
1165
1166 filter(predicate: typeof Boolean): Map<K, $NonMaybeType<V>>;
1167 filter(
1168 predicate: (value: V, key: K, iter: this) => mixed,
1169 context?: mixed
1170 ): Map<K, V>;
1171
1172 partition(
1173 predicate: (value: V, key: K, iter: this) => mixed,
1174 context?: mixed
1175 ): [this, this];
1176
1177 map<M>(
1178 mapper: (value: V, key: K, iter: this) => M,
1179 context?: mixed
1180 ): Map<K, M>;
1181
1182 mapKeys<M>(
1183 mapper: (key: K, value: V, iter: this) => M,
1184 context?: mixed
1185 ): Map<M, V>;
1186
1187 mapEntries<KM, VM>(
1188 mapper: (entry: [K, V], index: number, iter: this) => [KM, VM],
1189 context?: mixed
1190 ): Map<KM, VM>;
1191
1192 flatMap<KM, VM>(
1193 mapper: (value: V, key: K, iter: this) => Iterable<[KM, VM]>,
1194 context?: mixed
1195 ): Map<KM, VM>;
1196
1197 flatten(depth?: number): Map<any, any>;
1198 flatten(shallow?: boolean): Map<any, any>;
1199}
1200
1201declare function isOrderedMap(
1202 maybeOrderedMap: mixed
1203): boolean %checks(maybeOrderedMap instanceof OrderedMap);
1204declare class OrderedMap<K, +V>
1205 extends Map<K, V>
1206 mixins UpdatableInCollection<K, V>
1207{
1208 static <K, V>(
1209 values?: Iterable<[K, V]> | PlainObjInput<K, V>
1210 ): OrderedMap<K, V>;
1211
1212 static isOrderedMap: typeof isOrderedMap;
1213
1214 size: number;
1215
1216 set<K_, V_>(key: K_, value: V_): OrderedMap<K | K_, V | V_>;
1217 delete(key: K): this;
1218 remove(key: K): this;
1219 clear(): this;
1220
1221 update<U>(updater: (value: this) => U): U;
1222 update<V_>(key: K, updater: (value: V) => V_): OrderedMap<K, V | V_>;
1223 update<V_>(
1224 key: K,
1225 notSetValue: V_,
1226 updater: (value: V) => V_
1227 ): OrderedMap<K, V | V_>;
1228
1229 merge<K_, V_>(
1230 ...collections: (Iterable<[K_, V_]> | PlainObjInput<K_, V_>)[]
1231 ): OrderedMap<K | K_, V | V_>;
1232 concat<K_, V_>(
1233 ...collections: (Iterable<[K_, V_]> | PlainObjInput<K_, V_>)[]
1234 ): OrderedMap<K | K_, V | V_>;
1235
1236 mergeWith<K_, W, X>(
1237 merger: (oldVal: V, newVal: W, key: K) => X,
1238 ...collections: (Iterable<[K_, W]> | PlainObjInput<K_, W>)[]
1239 ): OrderedMap<K | K_, V | W | X>;
1240
1241 mergeDeep<K_, V_>(
1242 ...collections: (Iterable<[K_, V_]> | PlainObjInput<K_, V_>)[]
1243 ): OrderedMap<K | K_, V | V_>;
1244
1245 mergeDeepWith<K_, V_>(
1246 merger: (oldVal: any, newVal: any, key: any) => mixed,
1247 ...collections: (Iterable<[K_, V_]> | PlainObjInput<K_, V_>)[]
1248 ): OrderedMap<K | K_, V | V_>;
1249
1250 mergeIn(
1251 keyPath: Iterable<mixed>,
1252 ...collections: (Iterable<mixed> | PlainObjInput<mixed, mixed>)[]
1253 ): this;
1254 mergeDeepIn(
1255 keyPath: Iterable<mixed>,
1256 ...collections: (Iterable<mixed> | PlainObjInput<mixed, mixed>)[]
1257 ): this;
1258
1259 withMutations(mutator: (mutable: this) => mixed): this;
1260 asMutable(): this;
1261 wasAltered(): boolean;
1262 asImmutable(): this;
1263
1264 // Override specialized return types
1265
1266 flip(): OrderedMap<V, K>;
1267
1268 filter(predicate: typeof Boolean): OrderedMap<K, $NonMaybeType<V>>;
1269 filter(
1270 predicate: (value: V, key: K, iter: this) => mixed,
1271 context?: mixed
1272 ): OrderedMap<K, V>;
1273
1274 partition(
1275 predicate: (value: V, key: K, iter: this) => mixed,
1276 context?: mixed
1277 ): [this, this];
1278
1279 map<M>(
1280 mapper: (value: V, key: K, iter: this) => M,
1281 context?: mixed
1282 ): OrderedMap<K, M>;
1283
1284 mapKeys<M>(
1285 mapper: (key: K, value: V, iter: this) => M,
1286 context?: mixed
1287 ): OrderedMap<M, V>;
1288
1289 mapEntries<KM, VM>(
1290 mapper: (entry: [K, V], index: number, iter: this) => [KM, VM],
1291 context?: mixed
1292 ): OrderedMap<KM, VM>;
1293
1294 flatMap<KM, VM>(
1295 mapper: (value: V, key: K, iter: this) => Iterable<[KM, VM]>,
1296 context?: mixed
1297 ): OrderedMap<KM, VM>;
1298
1299 flatten(depth?: number): OrderedMap<any, any>;
1300 flatten(shallow?: boolean): OrderedMap<any, any>;
1301}
1302
1303declare function isSet(maybeSet: mixed): boolean %checks(maybeSet instanceof
1304 Set);
1305declare class Set<+T> extends SetCollection<T> {
1306 static <T>(values?: Iterable<T>): Set<T>;
1307
1308 static of<T>(...values: T[]): Set<T>;
1309 static fromKeys<T>(
1310 values: Iterable<[T, mixed]> | PlainObjInput<T, mixed>
1311 ): Set<T>;
1312
1313 static intersect<T>(sets: Iterable<Iterable<T>>): Set<T>;
1314 static union<T>(sets: Iterable<Iterable<T>>): Set<T>;
1315
1316 static isSet: typeof isSet;
1317
1318 size: number;
1319
1320 add<U>(value: U): Set<T | U>;
1321 delete(value: T): this;
1322 remove(value: T): this;
1323 clear(): this;
1324 union<U>(...collections: Iterable<U>[]): Set<T | U>;
1325 merge<U>(...collections: Iterable<U>[]): Set<T | U>;
1326 concat<U>(...collections: Iterable<U>[]): Set<T | U>;
1327 intersect<U>(...collections: Iterable<U>[]): Set<T & U>;
1328 subtract(...collections: Iterable<mixed>[]): this;
1329
1330 withMutations(mutator: (mutable: this) => mixed): this;
1331 asMutable(): this;
1332 wasAltered(): boolean;
1333 asImmutable(): this;
1334
1335 // Override specialized return types
1336
1337 filter(predicate: typeof Boolean): Set<$NonMaybeType<T>>;
1338 filter(
1339 predicate: (value: T, value: T, iter: this) => mixed,
1340 context?: mixed
1341 ): Set<T>;
1342
1343 partition(
1344 predicate: (value: T, value: T, iter: this) => mixed,
1345 context?: mixed
1346 ): [this, this];
1347
1348 map<M>(
1349 mapper: (value: T, value: T, iter: this) => M,
1350 context?: mixed
1351 ): Set<M>;
1352
1353 flatMap<M>(
1354 mapper: (value: T, value: T, iter: this) => Iterable<M>,
1355 context?: mixed
1356 ): Set<M>;
1357
1358 flatten(depth?: number): Set<any>;
1359 flatten(shallow?: boolean): Set<any>;
1360}
1361
1362// Overrides except for `isOrderedSet` are for specialized return types
1363declare function isOrderedSet(
1364 maybeOrderedSet: mixed
1365): boolean %checks(maybeOrderedSet instanceof OrderedSet);
1366declare class OrderedSet<+T> extends Set<T> {
1367 static <T>(values?: Iterable<T>): OrderedSet<T>;
1368
1369 static of<T>(...values: T[]): OrderedSet<T>;
1370 static fromKeys<T>(
1371 values: Iterable<[T, mixed]> | PlainObjInput<T, mixed>
1372 ): OrderedSet<T>;
1373
1374 static isOrderedSet: typeof isOrderedSet;
1375
1376 size: number;
1377
1378 add<U>(value: U): OrderedSet<T | U>;
1379 union<U>(...collections: Iterable<U>[]): OrderedSet<T | U>;
1380 merge<U>(...collections: Iterable<U>[]): OrderedSet<T | U>;
1381 concat<U>(...collections: Iterable<U>[]): OrderedSet<T | U>;
1382 intersect<U>(...collections: Iterable<U>[]): OrderedSet<T & U>;
1383
1384 filter(predicate: typeof Boolean): OrderedSet<$NonMaybeType<T>>;
1385 filter(
1386 predicate: (value: T, value: T, iter: this) => mixed,
1387 context?: mixed
1388 ): OrderedSet<T>;
1389
1390 partition(
1391 predicate: (value: T, value: T, iter: this) => mixed,
1392 context?: mixed
1393 ): [this, this];
1394
1395 map<M>(
1396 mapper: (value: T, value: T, iter: this) => M,
1397 context?: mixed
1398 ): OrderedSet<M>;
1399
1400 flatMap<M>(
1401 mapper: (value: T, value: T, iter: this) => Iterable<M>,
1402 context?: mixed
1403 ): OrderedSet<M>;
1404
1405 flatten(depth?: number): OrderedSet<any>;
1406 flatten(shallow?: boolean): OrderedSet<any>;
1407
1408 zip<A>(a: Iterable<A>, ..._: []): OrderedSet<[T, A]>;
1409 zip<A, B>(a: Iterable<A>, b: Iterable<B>, ..._: []): OrderedSet<[T, A, B]>;
1410 zip<A, B, C>(
1411 a: Iterable<A>,
1412 b: Iterable<B>,
1413 c: Iterable<C>,
1414 ..._: []
1415 ): OrderedSet<[T, A, B, C]>;
1416 zip<A, B, C, D>(
1417 a: Iterable<A>,
1418 b: Iterable<B>,
1419 c: Iterable<C>,
1420 d: Iterable<D>,
1421 ..._: []
1422 ): OrderedSet<[T, A, B, C, D]>;
1423 zip<A, B, C, D, E>(
1424 a: Iterable<A>,
1425 b: Iterable<B>,
1426 c: Iterable<C>,
1427 d: Iterable<D>,
1428 e: Iterable<E>,
1429 ..._: []
1430 ): OrderedSet<[T, A, B, C, D, E]>;
1431
1432 zipAll<A>(a: Iterable<A>, ..._: []): OrderedSet<[T | void, A | void]>;
1433 zipAll<A, B>(
1434 a: Iterable<A>,
1435 b: Iterable<B>,
1436 ..._: []
1437 ): OrderedSet<[T | void, A | void, B | void]>;
1438 zipAll<A, B, C>(
1439 a: Iterable<A>,
1440 b: Iterable<B>,
1441 c: Iterable<C>,
1442 ..._: []
1443 ): OrderedSet<[T | void, A | void, B | void, C | void]>;
1444 zipAll<A, B, C, D>(
1445 a: Iterable<A>,
1446 b: Iterable<B>,
1447 c: Iterable<C>,
1448 d: Iterable<D>,
1449 ..._: []
1450 ): OrderedSet<[T | void, A | void, B | void, C | void, D | void]>;
1451 zipAll<A, B, C, D, E>(
1452 a: Iterable<A>,
1453 b: Iterable<B>,
1454 c: Iterable<C>,
1455 d: Iterable<D>,
1456 e: Iterable<E>,
1457 ..._: []
1458 ): OrderedSet<[T | void, A | void, B | void, C | void, D | void, E | void]>;
1459
1460 zipWith<A, R>(
1461 zipper: (value: T, a: A) => R,
1462 a: Iterable<A>,
1463 ..._: []
1464 ): OrderedSet<R>;
1465 zipWith<A, B, R>(
1466 zipper: (value: T, a: A, b: B) => R,
1467 a: Iterable<A>,
1468 b: Iterable<B>,
1469 ..._: []
1470 ): OrderedSet<R>;
1471 zipWith<A, B, C, R>(
1472 zipper: (value: T, a: A, b: B, c: C) => R,
1473 a: Iterable<A>,
1474 b: Iterable<B>,
1475 c: Iterable<C>,
1476 ..._: []
1477 ): OrderedSet<R>;
1478 zipWith<A, B, C, D, R>(
1479 zipper: (value: T, a: A, b: B, c: C, d: D) => R,
1480 a: Iterable<A>,
1481 b: Iterable<B>,
1482 c: Iterable<C>,
1483 d: Iterable<D>,
1484 ..._: []
1485 ): OrderedSet<R>;
1486 zipWith<A, B, C, D, E, R>(
1487 zipper: (value: T, a: A, b: B, c: C, d: D, e: E) => R,
1488 a: Iterable<A>,
1489 b: Iterable<B>,
1490 c: Iterable<C>,
1491 d: Iterable<D>,
1492 e: Iterable<E>,
1493 ..._: []
1494 ): OrderedSet<R>;
1495}
1496
1497declare function isStack(
1498 maybeStack: mixed
1499): boolean %checks(maybeStack instanceof Stack);
1500declare class Stack<+T> extends IndexedCollection<T> {
1501 static <T>(collection?: Iterable<T>): Stack<T>;
1502
1503 static isStack(maybeStack: mixed): boolean;
1504 static of<T>(...values: T[]): Stack<T>;
1505
1506 static isStack: typeof isStack;
1507
1508 size: number;
1509
1510 peek(): T;
1511 clear(): this;
1512 unshift<U>(...values: U[]): Stack<T | U>;
1513 unshiftAll<U>(iter: Iterable<U>): Stack<T | U>;
1514 shift(): this;
1515 push<U>(...values: U[]): Stack<T | U>;
1516 pushAll<U>(iter: Iterable<U>): Stack<T | U>;
1517 pop(): this;
1518
1519 withMutations(mutator: (mutable: this) => mixed): this;
1520 asMutable(): this;
1521 wasAltered(): boolean;
1522 asImmutable(): this;
1523
1524 // Override specialized return types
1525
1526 concat<C>(...iters: Array<Iterable<C> | C>): Stack<T | C>;
1527
1528 filter(predicate: typeof Boolean): Stack<$NonMaybeType<T>>;
1529 filter(
1530 predicate: (value: T, index: number, iter: this) => mixed,
1531 context?: mixed
1532 ): Stack<T>;
1533
1534 map<M>(
1535 mapper: (value: T, index: number, iter: this) => M,
1536 context?: mixed
1537 ): Stack<M>;
1538
1539 flatMap<M>(
1540 mapper: (value: T, index: number, iter: this) => Iterable<M>,
1541 context?: mixed
1542 ): Stack<M>;
1543
1544 flatten(depth?: number): Stack<any>;
1545 flatten(shallow?: boolean): Stack<any>;
1546
1547 zip<A>(a: Iterable<A>, ..._: []): Stack<[T, A]>;
1548 zip<A, B>(a: Iterable<A>, b: Iterable<B>, ..._: []): Stack<[T, A, B]>;
1549 zip<A, B, C>(
1550 a: Iterable<A>,
1551 b: Iterable<B>,
1552 c: Iterable<C>,
1553 ..._: []
1554 ): Stack<[T, A, B, C]>;
1555 zip<A, B, C, D>(
1556 a: Iterable<A>,
1557 b: Iterable<B>,
1558 c: Iterable<C>,
1559 d: Iterable<D>,
1560 ..._: []
1561 ): Stack<[T, A, B, C, D]>;
1562 zip<A, B, C, D, E>(
1563 a: Iterable<A>,
1564 b: Iterable<B>,
1565 c: Iterable<C>,
1566 d: Iterable<D>,
1567 e: Iterable<E>,
1568 ..._: []
1569 ): Stack<[T, A, B, C, D, E]>;
1570
1571 zipAll<A>(a: Iterable<A>, ..._: []): Stack<[T | void, A | void]>;
1572 zipAll<A, B>(
1573 a: Iterable<A>,
1574 b: Iterable<B>,
1575 ..._: []
1576 ): Stack<[T | void, A | void, B | void]>;
1577 zipAll<A, B, C>(
1578 a: Iterable<A>,
1579 b: Iterable<B>,
1580 c: Iterable<C>,
1581 ..._: []
1582 ): Stack<[T | void, A | void, B | void, C | void]>;
1583 zipAll<A, B, C, D>(
1584 a: Iterable<A>,
1585 b: Iterable<B>,
1586 c: Iterable<C>,
1587 d: Iterable<D>,
1588 ..._: []
1589 ): Stack<[T | void, A | void, B | void, C | void, D | void]>;
1590 zipAll<A, B, C, D, E>(
1591 a: Iterable<A>,
1592 b: Iterable<B>,
1593 c: Iterable<C>,
1594 d: Iterable<D>,
1595 e: Iterable<E>,
1596 ..._: []
1597 ): Stack<[T | void, A | void, B | void, C | void, D | void, E | void]>;
1598
1599 zipWith<A, R>(
1600 zipper: (value: T, a: A) => R,
1601 a: Iterable<A>,
1602 ..._: []
1603 ): Stack<R>;
1604 zipWith<A, B, R>(
1605 zipper: (value: T, a: A, b: B) => R,
1606 a: Iterable<A>,
1607 b: Iterable<B>,
1608 ..._: []
1609 ): Stack<R>;
1610 zipWith<A, B, C, R>(
1611 zipper: (value: T, a: A, b: B, c: C) => R,
1612 a: Iterable<A>,
1613 b: Iterable<B>,
1614 c: Iterable<C>,
1615 ..._: []
1616 ): Stack<R>;
1617 zipWith<A, B, C, D, R>(
1618 zipper: (value: T, a: A, b: B, c: C, d: D) => R,
1619 a: Iterable<A>,
1620 b: Iterable<B>,
1621 c: Iterable<C>,
1622 d: Iterable<D>,
1623 ..._: []
1624 ): Stack<R>;
1625 zipWith<A, B, C, D, E, R>(
1626 zipper: (value: T, a: A, b: B, c: C, d: D, e: E) => R,
1627 a: Iterable<A>,
1628 b: Iterable<B>,
1629 c: Iterable<C>,
1630 d: Iterable<D>,
1631 e: Iterable<E>,
1632 ..._: []
1633 ): Stack<R>;
1634}
1635
1636declare function Range(
1637 start?: number,
1638 end?: number,
1639 step?: number
1640): IndexedSeq<number>;
1641declare function Repeat<T>(value: T, times?: number): IndexedSeq<T>;
1642
1643// The type of a Record factory function.
1644type RecordFactory<Values: Object> = Class<RecordInstance<Values>>;
1645
1646// The type of runtime Record instances.
1647type RecordOf<Values: Object> = RecordInstance<Values> & $ReadOnly<Values>;
1648
1649// The values of a Record instance.
1650type _RecordValues<T, R: RecordInstance<T> | T> = R;
1651type RecordValues<R> = _RecordValues<*, R>;
1652
1653declare function isRecord(
1654 maybeRecord: any
1655): boolean %checks(maybeRecord instanceof RecordInstance);
1656declare class Record {
1657 static <Values: Object>(spec: Values, name?: string): typeof RecordInstance;
1658 constructor<Values: Object>(
1659 spec: Values,
1660 name?: string
1661 ): typeof RecordInstance;
1662
1663 static isRecord: typeof isRecord;
1664
1665 static getDescriptiveName(record: RecordInstance<any>): string;
1666}
1667
1668declare class RecordInstance<T: Object = Object> {
1669 static (values?: Iterable<[$Keys<T>, $ValOf<T>]> | $Shape<T>): RecordOf<T>;
1670 // Note: a constructor can only create an instance of RecordInstance<T>,
1671 // it's encouraged to not use `new` when creating Records.
1672 constructor(values?: Iterable<[$Keys<T>, $ValOf<T>]> | $Shape<T>): void;
1673
1674 size: number;
1675
1676 has(key: string): boolean;
1677
1678 get<K: $Keys<T>>(key: K, ..._: []): $ElementType<T, K>;
1679 get<K: $Keys<T>, NSV>(key: K, notSetValue: NSV): $ElementType<T, K> | NSV;
1680
1681 hasIn(keyPath: Iterable<mixed>): boolean;
1682
1683 getIn(keyPath: [], notSetValue?: mixed): this & $ReadOnly<T>;
1684 getIn<K: $Keys<T>>(keyPath: [K], notSetValue?: mixed): $ElementType<T, K>;
1685 getIn<NSV, K: $Keys<T>, K2: $KeyOf<$ValOf<T, K>>>(
1686 keyPath: [K, K2],
1687 notSetValue: NSV
1688 ): $ValOf<$ValOf<T, K>, K2> | NSV;
1689 getIn<
1690 NSV,
1691 K: $Keys<T>,
1692 K2: $KeyOf<$ValOf<T, K>>,
1693 K3: $KeyOf<$ValOf<$ValOf<T, K>, K2>>
1694 >(
1695 keyPath: [K, K2, K3],
1696 notSetValue: NSV
1697 ): $ValOf<$ValOf<$ValOf<T, K>, K2>, K3> | NSV;
1698 getIn<
1699 NSV,
1700 K: $Keys<T>,
1701 K2: $KeyOf<$ValOf<T, K>>,
1702 K3: $KeyOf<$ValOf<$ValOf<T, K>, K2>>,
1703 K4: $KeyOf<$ValOf<$ValOf<$ValOf<T, K>, K2>, K3>>
1704 >(
1705 keyPath: [K, K2, K3, K4],
1706 notSetValue: NSV
1707 ): $ValOf<$ValOf<$ValOf<$ValOf<T, K>, K2>, K3>, K4> | NSV;
1708 getIn<
1709 NSV,
1710 K: $Keys<T>,
1711 K2: $KeyOf<$ValOf<T, K>>,
1712 K3: $KeyOf<$ValOf<$ValOf<T, K>, K2>>,
1713 K4: $KeyOf<$ValOf<$ValOf<$ValOf<T, K>, K2>, K3>>,
1714 K5: $KeyOf<$ValOf<$ValOf<$ValOf<$ValOf<T, K>, K2>, K3>, K4>>
1715 >(
1716 keyPath: [K, K2, K3, K4, K5],
1717 notSetValue: NSV
1718 ): $ValOf<$ValOf<$ValOf<$ValOf<$ValOf<T, K>, K2>, K3>, K4>, K5> | NSV;
1719
1720 equals(other: any): boolean;
1721 hashCode(): number;
1722
1723 set<K: $Keys<T>>(key: K, value: $ElementType<T, K>): this & $ReadOnly<T>;
1724 update<K: $Keys<T>>(
1725 key: K,
1726 updater: (value: $ElementType<T, K>) => $ElementType<T, K>
1727 ): this & $ReadOnly<T>;
1728 merge(
1729 ...collections: Array<Iterable<[$Keys<T>, $ValOf<T>]> | $Shape<T>>
1730 ): this & $ReadOnly<T>;
1731 mergeDeep(
1732 ...collections: Array<Iterable<[$Keys<T>, $ValOf<T>]> | $Shape<T>>
1733 ): this & $ReadOnly<T>;
1734
1735 mergeWith(
1736 merger: (oldVal: $ValOf<T>, newVal: $ValOf<T>, key: $Keys<T>) => $ValOf<T>,
1737 ...collections: Array<Iterable<[$Keys<T>, $ValOf<T>]> | $Shape<T>>
1738 ): this & $ReadOnly<T>;
1739 mergeDeepWith(
1740 merger: (oldVal: any, newVal: any, key: any) => any,
1741 ...collections: Array<Iterable<[$Keys<T>, $ValOf<T>]> | $Shape<T>>
1742 ): this & $ReadOnly<T>;
1743
1744 delete<K: $Keys<T>>(key: K): this & $ReadOnly<T>;
1745 remove<K: $Keys<T>>(key: K): this & $ReadOnly<T>;
1746 clear(): this & $ReadOnly<T>;
1747
1748 setIn<S>(keyPath: [], value: S): S;
1749 setIn<K: $Keys<T>, S: $ValOf<T, K>>(
1750 keyPath: [K],
1751 value: S
1752 ): this & $ReadOnly<T>;
1753 setIn<K: $Keys<T>, K2: $KeyOf<$ValOf<T, K>>, S: $ValOf<$ValOf<T, K>, K2>>(
1754 keyPath: [K, K2],
1755 value: S
1756 ): this & $ReadOnly<T>;
1757 setIn<
1758 K: $Keys<T>,
1759 K2: $KeyOf<$ValOf<T, K>>,
1760 K3: $KeyOf<$ValOf<$ValOf<T, K>, K2>>,
1761 S: $ValOf<$ValOf<$ValOf<T, K>, K2>, K3>
1762 >(
1763 keyPath: [K, K2, K3],
1764 value: S
1765 ): this & $ReadOnly<T>;
1766 setIn<
1767 K: $Keys<T>,
1768 K2: $KeyOf<$ValOf<T, K>>,
1769 K3: $KeyOf<$ValOf<$ValOf<T, K>, K2>>,
1770 K4: $KeyOf<$ValOf<$ValOf<$ValOf<T, K>, K2>, K3>>,
1771 S: $ValOf<$ValOf<$ValOf<$ValOf<T, K>, K2>, K3>, K4>
1772 >(
1773 keyPath: [K, K2, K3, K4],
1774 value: S
1775 ): this & $ReadOnly<T>;
1776 setIn<
1777 K: $Keys<T>,
1778 K2: $KeyOf<$ValOf<T, K>>,
1779 K3: $KeyOf<$ValOf<$ValOf<T, K>, K2>>,
1780 K4: $KeyOf<$ValOf<$ValOf<$ValOf<T, K>, K2>, K3>>,
1781 K5: $KeyOf<$ValOf<$ValOf<$ValOf<$ValOf<T, K>, K2>, K3>, K4>>,
1782 S: $ValOf<$ValOf<$ValOf<$ValOf<$ValOf<T, K>, K2>, K3>, K4>, K5>
1783 >(
1784 keyPath: [K, K2, K3, K4, K5],
1785 value: S
1786 ): this & $ReadOnly<T>;
1787
1788 deleteIn(keyPath: []): void;
1789 deleteIn<K: $Keys<T>>(keyPath: [K]): this & $ReadOnly<T>;
1790 deleteIn<K: $Keys<T>, K2: $KeyOf<$ValOf<T, K>>>(
1791 keyPath: [K, K2]
1792 ): this & $ReadOnly<T>;
1793 deleteIn<
1794 K: $Keys<T>,
1795 K2: $KeyOf<$ValOf<T, K>>,
1796 K3: $KeyOf<$ValOf<$ValOf<T, K>, K2>>
1797 >(
1798 keyPath: [K, K2, K3]
1799 ): this & $ReadOnly<T>;
1800 deleteIn<
1801 K: $Keys<T>,
1802 K2: $KeyOf<$ValOf<T, K>>,
1803 K3: $KeyOf<$ValOf<$ValOf<T, K>, K2>>,
1804 K4: $KeyOf<$ValOf<$ValOf<$ValOf<T, K>, K2>, K3>>
1805 >(
1806 keyPath: [K, K2, K3, K4]
1807 ): this & $ReadOnly<T>;
1808 deleteIn<
1809 K: $Keys<T>,
1810 K2: $KeyOf<$ValOf<T, K>>,
1811 K3: $KeyOf<$ValOf<$ValOf<T, K>, K2>>,
1812 K4: $KeyOf<$ValOf<$ValOf<$ValOf<T, K>, K2>, K3>>,
1813 K5: $KeyOf<$ValOf<$ValOf<$ValOf<$ValOf<T, K>, K2>, K3>, K4>>
1814 >(
1815 keyPath: [K, K2, K3, K4, K5]
1816 ): this & $ReadOnly<T>;
1817
1818 removeIn(keyPath: []): void;
1819 removeIn<K: $Keys<T>>(keyPath: [K]): this & $ReadOnly<T>;
1820 removeIn<K: $Keys<T>, K2: $KeyOf<$ValOf<T, K>>>(
1821 keyPath: [K, K2]
1822 ): this & $ReadOnly<T>;
1823 removeIn<
1824 K: $Keys<T>,
1825 K2: $KeyOf<$ValOf<T, K>>,
1826 K3: $KeyOf<$ValOf<$ValOf<T, K>, K2>>
1827 >(
1828 keyPath: [K, K2, K3]
1829 ): this & $ReadOnly<T>;
1830 removeIn<
1831 K: $Keys<T>,
1832 K2: $KeyOf<$ValOf<T, K>>,
1833 K3: $KeyOf<$ValOf<$ValOf<T, K>, K2>>,
1834 K4: $KeyOf<$ValOf<$ValOf<$ValOf<T, K>, K2>, K3>>
1835 >(
1836 keyPath: [K, K2, K3, K4]
1837 ): this & $ReadOnly<T>;
1838 removeIn<
1839 K: $Keys<T>,
1840 K2: $KeyOf<$ValOf<T, K>>,
1841 K3: $KeyOf<$ValOf<$ValOf<T, K>, K2>>,
1842 K4: $KeyOf<$ValOf<$ValOf<$ValOf<T, K>, K2>, K3>>,
1843 K5: $KeyOf<$ValOf<$ValOf<$ValOf<$ValOf<T, K>, K2>, K3>, K4>>
1844 >(
1845 keyPath: [K, K2, K3, K4, K5]
1846 ): this & $ReadOnly<T>;
1847
1848 updateIn<U>(
1849 keyPath: [],
1850 notSetValue: mixed,
1851 updater: (value: this & T) => U
1852 ): U;
1853 updateIn<U>(keyPath: [], updater: (value: this & T) => U): U;
1854 updateIn<NSV, K: $Keys<T>, S: $ValOf<T, K>>(
1855 keyPath: [K],
1856 notSetValue: NSV,
1857 updater: (value: $ValOf<T, K>) => S
1858 ): this & $ReadOnly<T>;
1859 updateIn<K: $Keys<T>, S: $ValOf<T, K>>(
1860 keyPath: [K],
1861 updater: (value: $ValOf<T, K>) => S
1862 ): this & $ReadOnly<T>;
1863 updateIn<
1864 NSV,
1865 K: $Keys<T>,
1866 K2: $KeyOf<$ValOf<T, K>>,
1867 S: $ValOf<$ValOf<T, K>, K2>
1868 >(
1869 keyPath: [K, K2],
1870 notSetValue: NSV,
1871 updater: (value: $ValOf<$ValOf<T, K>, K2> | NSV) => S
1872 ): this & $ReadOnly<T>;
1873 updateIn<K: $Keys<T>, K2: $KeyOf<$ValOf<T, K>>, S: $ValOf<$ValOf<T, K>, K2>>(
1874 keyPath: [K, K2],
1875 updater: (value: $ValOf<$ValOf<T, K>, K2>) => S
1876 ): this & $ReadOnly<T>;
1877 updateIn<
1878 NSV,
1879 K: $Keys<T>,
1880 K2: $KeyOf<$ValOf<T, K>>,
1881 K3: $KeyOf<$ValOf<$ValOf<T, K>, K2>>,
1882 S: $ValOf<$ValOf<$ValOf<T, K>, K2>, K3>
1883 >(
1884 keyPath: [K, K2, K3],
1885 notSetValue: NSV,
1886 updater: (value: $ValOf<$ValOf<$ValOf<T, K>, K2>, K3> | NSV) => S
1887 ): this & $ReadOnly<T>;
1888 updateIn<
1889 K: $Keys<T>,
1890 K2: $KeyOf<$ValOf<T, K>>,
1891 K3: $KeyOf<$ValOf<$ValOf<T, K>, K2>>,
1892 S: $ValOf<$ValOf<$ValOf<T, K>, K2>, K3>
1893 >(
1894 keyPath: [K, K2, K3],
1895 updater: (value: $ValOf<$ValOf<$ValOf<T, K>, K2>, K3>) => S
1896 ): this & $ReadOnly<T>;
1897 updateIn<
1898 NSV,
1899 K: $Keys<T>,
1900 K2: $KeyOf<$ValOf<T, K>>,
1901 K3: $KeyOf<$ValOf<$ValOf<T, K>, K2>>,
1902 K4: $KeyOf<$ValOf<$ValOf<$ValOf<T, K>, K2>, K3>>,
1903 S: $ValOf<$ValOf<$ValOf<$ValOf<T, K>, K2>, K3>, K4>
1904 >(
1905 keyPath: [K, K2, K3, K4],
1906 notSetValue: NSV,
1907 updater: (
1908 value: $ValOf<$ValOf<$ValOf<$ValOf<T, K>, K2>, K3>, K4> | NSV
1909 ) => S
1910 ): this & $ReadOnly<T>;
1911 updateIn<
1912 K: $Keys<T>,
1913 K2: $KeyOf<$ValOf<T, K>>,
1914 K3: $KeyOf<$ValOf<$ValOf<T, K>, K2>>,
1915 K4: $KeyOf<$ValOf<$ValOf<$ValOf<T, K>, K2>, K3>>,
1916 S: $ValOf<$ValOf<$ValOf<$ValOf<T, K>, K2>, K3>, K4>
1917 >(
1918 keyPath: [K, K2, K3, K4],
1919 updater: (value: $ValOf<$ValOf<$ValOf<$ValOf<T, K>, K2>, K3>, K4>) => S
1920 ): this & $ReadOnly<T>;
1921 updateIn<
1922 NSV,
1923 K: $Keys<T>,
1924 K2: $KeyOf<$ValOf<T, K>>,
1925 K3: $KeyOf<$ValOf<$ValOf<T, K>, K2>>,
1926 K4: $KeyOf<$ValOf<$ValOf<$ValOf<T, K>, K2>, K3>>,
1927 K5: $KeyOf<$ValOf<$ValOf<$ValOf<$ValOf<T, K>, K2>, K3>, K4>>,
1928 S: $ValOf<$ValOf<$ValOf<$ValOf<$ValOf<T, K>, K2>, K3>, K4>, K5>
1929 >(
1930 keyPath: [K, K2, K3, K4, K5],
1931 notSetValue: NSV,
1932 updater: (
1933 value: $ValOf<$ValOf<$ValOf<$ValOf<$ValOf<T, K>, K2>, K3>, K4>, K5> | NSV
1934 ) => S
1935 ): this & $ReadOnly<T>;
1936 updateIn<
1937 K: $Keys<T>,
1938 K2: $KeyOf<$ValOf<T, K>>,
1939 K3: $KeyOf<$ValOf<$ValOf<T, K>, K2>>,
1940 K4: $KeyOf<$ValOf<$ValOf<$ValOf<T, K>, K2>, K3>>,
1941 K5: $KeyOf<$ValOf<$ValOf<$ValOf<$ValOf<T, K>, K2>, K3>, K4>>,
1942 S: $ValOf<$ValOf<$ValOf<$ValOf<$ValOf<T, K>, K2>, K3>, K4>, K5>
1943 >(
1944 keyPath: [K, K2, K3, K4, K5],
1945 updater: (
1946 value: $ValOf<$ValOf<$ValOf<$ValOf<$ValOf<T, K>, K2>, K3>, K4>, K5>
1947 ) => S
1948 ): this & $ReadOnly<T>;
1949
1950 mergeIn(
1951 keyPath: Iterable<mixed>,
1952 ...collections: Array<any>
1953 ): this & $ReadOnly<T>;
1954 mergeDeepIn(
1955 keyPath: Iterable<mixed>,
1956 ...collections: Array<any>
1957 ): this & $ReadOnly<T>;
1958
1959 toSeq(): KeyedSeq<$Keys<T>, any>;
1960
1961 toJS(): { [key: $Keys<T>]: mixed };
1962 toJSON(): T;
1963 toObject(): T;
1964
1965 withMutations(mutator: (mutable: this & T) => mixed): this & $ReadOnly<T>;
1966 asMutable(): this & $ReadOnly<T>;
1967 wasAltered(): boolean;
1968 asImmutable(): this & $ReadOnly<T>;
1969
1970 @@iterator(): Iterator<[$Keys<T>, $ValOf<T>]>;
1971}
1972
1973declare function fromJS(
1974 jsValue: mixed,
1975 reviver?: (
1976 key: string | number,
1977 sequence: KeyedCollection<string, mixed> | IndexedCollection<mixed>,
1978 path?: Array<string | number>
1979 ) => mixed
1980): Collection<mixed, mixed>;
1981
1982declare function is(first: mixed, second: mixed): boolean;
1983declare function hash(value: mixed): number;
1984
1985declare function get<C: Object, K: $Keys<C>>(
1986 collection: C,
1987 key: K,
1988 notSetValue: mixed
1989): $ValOf<C, K>;
1990declare function get<C, K: $KeyOf<C>, NSV>(
1991 collection: C,
1992 key: K,
1993 notSetValue: NSV
1994): $ValOf<C, K> | NSV;
1995
1996declare function has(collection: Object, key: mixed): boolean;
1997declare function remove<C>(collection: C, key: $KeyOf<C>): C;
1998declare function set<C, K: $KeyOf<C>, V: $ValOf<C, K>>(
1999 collection: C,
2000 key: K,
2001 value: V
2002): C;
2003declare function update<C, K: $KeyOf<C>, V: $ValOf<C, K>, NSV>(
2004 collection: C,
2005 key: K,
2006 notSetValue: NSV,
2007 updater: ($ValOf<C, K> | NSV) => V
2008): C;
2009declare function update<C, K: $KeyOf<C>, V: $ValOf<C, K>>(
2010 collection: C,
2011 key: K,
2012 updater: ($ValOf<C, K>) => V
2013): C;
2014
2015declare function getIn<C>(collection: C, keyPath: [], notSetValue?: mixed): C;
2016declare function getIn<C, K: $KeyOf<C>, NSV>(
2017 collection: C,
2018 keyPath: [K],
2019 notSetValue: NSV
2020): $ValOf<C, K> | NSV;
2021declare function getIn<C, K: $KeyOf<C>, K2: $KeyOf<$ValOf<C, K>>, NSV>(
2022 collection: C,
2023 keyPath: [K, K2],
2024 notSetValue: NSV
2025): $ValOf<$ValOf<C, K>, K2> | NSV;
2026declare function getIn<
2027 C,
2028 K: $KeyOf<C>,
2029 K2: $KeyOf<$ValOf<C, K>>,
2030 K3: $KeyOf<$ValOf<$ValOf<C, K>, K2>>,
2031 NSV
2032>(
2033 collection: C,
2034 keyPath: [K, K2, K3],
2035 notSetValue: NSV
2036): $ValOf<$ValOf<$ValOf<C, K>, K2>, K3> | NSV;
2037declare function getIn<
2038 C,
2039 K: $KeyOf<C>,
2040 K2: $KeyOf<$ValOf<C, K>>,
2041 K3: $KeyOf<$ValOf<$ValOf<C, K>, K2>>,
2042 K4: $KeyOf<$ValOf<$ValOf<$ValOf<C, K>, K2>, K3>>,
2043 NSV
2044>(
2045 collection: C,
2046 keyPath: [K, K2, K3, K4],
2047 notSetValue: NSV
2048): $ValOf<$ValOf<$ValOf<$ValOf<C, K>, K2>, K3>, K4> | NSV;
2049declare function getIn<
2050 C,
2051 K: $KeyOf<C>,
2052 K2: $KeyOf<$ValOf<C, K>>,
2053 K3: $KeyOf<$ValOf<$ValOf<C, K>, K2>>,
2054 K4: $KeyOf<$ValOf<$ValOf<$ValOf<C, K>, K2>, K3>>,
2055 K5: $KeyOf<$ValOf<$ValOf<$ValOf<$ValOf<C, K>, K2>, K3>, K4>>,
2056 NSV
2057>(
2058 collection: C,
2059 keyPath: [K, K2, K3, K4, K5],
2060 notSetValue: NSV
2061): $ValOf<$ValOf<$ValOf<$ValOf<$ValOf<C, K>, K2>, K3>, K4>, K5> | NSV;
2062
2063declare function hasIn(collection: Object, keyPath: Iterable<mixed>): boolean;
2064
2065declare function removeIn<C>(collection: C, keyPath: []): void;
2066declare function removeIn<C, K: $KeyOf<C>>(collection: C, keyPath: [K]): C;
2067declare function removeIn<C, K: $KeyOf<C>, K2: $KeyOf<$ValOf<C, K>>>(
2068 collection: C,
2069 keyPath: [K, K2]
2070): C;
2071declare function removeIn<
2072 C,
2073 K: $KeyOf<C>,
2074 K2: $KeyOf<$ValOf<C, K>>,
2075 K3: $KeyOf<$ValOf<$ValOf<C, K>, K2>>
2076>(
2077 collection: C,
2078 keyPath: [K, K2, K3]
2079): C;
2080declare function removeIn<
2081 C,
2082 K: $KeyOf<C>,
2083 K2: $KeyOf<$ValOf<C, K>>,
2084 K3: $KeyOf<$ValOf<$ValOf<C, K>, K2>>,
2085 K4: $KeyOf<$ValOf<$ValOf<$ValOf<C, K>, K2>, K3>>
2086>(
2087 collection: C,
2088 keyPath: [K, K2, K3, K4]
2089): C;
2090declare function removeIn<
2091 C,
2092 K: $KeyOf<C>,
2093 K2: $KeyOf<$ValOf<C, K>>,
2094 K3: $KeyOf<$ValOf<$ValOf<C, K>, K2>>,
2095 K4: $KeyOf<$ValOf<$ValOf<$ValOf<C, K>, K2>, K3>>,
2096 K5: $KeyOf<$ValOf<$ValOf<$ValOf<$ValOf<C, K>, K2>, K3>, K4>>
2097>(
2098 collection: C,
2099 keyPath: [K, K2, K3, K4, K5]
2100): C;
2101
2102declare function setIn<S>(collection: Object, keyPath: [], value: S): S;
2103declare function setIn<C, K: $KeyOf<C>, S: $ValOf<C, K>>(
2104 collection: C,
2105 keyPath: [K],
2106 value: S
2107): C;
2108declare function setIn<
2109 C,
2110 K: $KeyOf<C>,
2111 K2: $KeyOf<$ValOf<C, K>>,
2112 S: $ValOf<$ValOf<C, K>, K2>
2113>(
2114 collection: C,
2115 keyPath: [K, K2],
2116 value: S
2117): C;
2118declare function setIn<
2119 C,
2120 K: $KeyOf<C>,
2121 K2: $KeyOf<$ValOf<C, K>>,
2122 K3: $KeyOf<$ValOf<$ValOf<C, K>, K2>>,
2123 S: $ValOf<$ValOf<$ValOf<C, K>, K2>, K3>
2124>(
2125 collection: C,
2126 keyPath: [K, K2, K3],
2127 value: S
2128): C;
2129declare function setIn<
2130 C,
2131 K: $KeyOf<C>,
2132 K2: $KeyOf<$ValOf<C, K>>,
2133 K3: $KeyOf<$ValOf<$ValOf<C, K>, K2>>,
2134 K4: $KeyOf<$ValOf<$ValOf<$ValOf<C, K>, K2>, K3>>,
2135 S: $ValOf<$ValOf<$ValOf<$ValOf<C, K>, K2>, K3>, K4>
2136>(
2137 collection: C,
2138 keyPath: [K, K2, K3, K4],
2139 value: S
2140): C;
2141declare function setIn<
2142 C,
2143 K: $KeyOf<C>,
2144 K2: $KeyOf<$ValOf<C, K>>,
2145 K3: $KeyOf<$ValOf<$ValOf<C, K>, K2>>,
2146 K4: $KeyOf<$ValOf<$ValOf<$ValOf<C, K>, K2>, K3>>,
2147 K5: $KeyOf<$ValOf<$ValOf<$ValOf<$ValOf<C, K>, K2>, K3>, K4>>,
2148 S: $ValOf<$ValOf<$ValOf<$ValOf<$ValOf<C, K>, K2>, K3>, K4>, K5>
2149>(
2150 collection: C,
2151 keyPath: [K, K2, K3, K4, K5],
2152 value: S
2153): C;
2154
2155declare function updateIn<C, S>(
2156 collection: C,
2157 keyPath: [],
2158 notSetValue: mixed,
2159 updater: (value: C) => S
2160): S;
2161declare function updateIn<C, S>(
2162 collection: C,
2163 keyPath: [],
2164 updater: (value: C) => S
2165): S;
2166declare function updateIn<C, K: $KeyOf<C>, S: $ValOf<C, K>, NSV>(
2167 collection: C,
2168 keyPath: [K],
2169 notSetValue: NSV,
2170 updater: (value: $ValOf<C, K> | NSV) => S
2171): C;
2172declare function updateIn<C, K: $KeyOf<C>, S: $ValOf<C, K>>(
2173 collection: C,
2174 keyPath: [K],
2175 updater: (value: $ValOf<C, K>) => S
2176): C;
2177declare function updateIn<
2178 C,
2179 K: $KeyOf<C>,
2180 K2: $KeyOf<$ValOf<C, K>>,
2181 S: $ValOf<$ValOf<C, K>, K2>,
2182 NSV
2183>(
2184 collection: C,
2185 keyPath: [K, K2],
2186 notSetValue: NSV,
2187 updater: (value: $ValOf<$ValOf<C, K>, K2> | NSV) => S
2188): C;
2189declare function updateIn<
2190 C,
2191 K: $KeyOf<C>,
2192 K2: $KeyOf<$ValOf<C, K>>,
2193 S: $ValOf<$ValOf<C, K>, K2>
2194>(
2195 collection: C,
2196 keyPath: [K, K2],
2197 updater: (value: $ValOf<$ValOf<C, K>, K2>) => S
2198): C;
2199declare function updateIn<
2200 C,
2201 K: $KeyOf<C>,
2202 K2: $KeyOf<$ValOf<C, K>>,
2203 K3: $KeyOf<$ValOf<$ValOf<C, K>, K2>>,
2204 S: $ValOf<$ValOf<$ValOf<C, K>, K2>, K3>,
2205 NSV
2206>(
2207 collection: C,
2208 keyPath: [K, K2, K3],
2209 notSetValue: NSV,
2210 updater: (value: $ValOf<$ValOf<$ValOf<C, K>, K2>, K3> | NSV) => S
2211): C;
2212declare function updateIn<
2213 C,
2214 K: $KeyOf<C>,
2215 K2: $KeyOf<$ValOf<C, K>>,
2216 K3: $KeyOf<$ValOf<$ValOf<C, K>, K2>>,
2217 S: $ValOf<$ValOf<$ValOf<C, K>, K2>, K3>
2218>(
2219 collection: C,
2220 keyPath: [K, K2, K3],
2221 updater: (value: $ValOf<$ValOf<$ValOf<C, K>, K2>, K3>) => S
2222): C;
2223declare function updateIn<
2224 C,
2225 K: $KeyOf<C>,
2226 K2: $KeyOf<$ValOf<C, K>>,
2227 K3: $KeyOf<$ValOf<$ValOf<C, K>, K2>>,
2228 K4: $KeyOf<$ValOf<$ValOf<$ValOf<C, K>, K2>, K3>>,
2229 S: $ValOf<$ValOf<$ValOf<$ValOf<C, K>, K2>, K3>, K4>,
2230 NSV
2231>(
2232 collection: C,
2233 keyPath: [K, K2, K3, K4],
2234 notSetValue: NSV,
2235 updater: (value: $ValOf<$ValOf<$ValOf<$ValOf<C, K>, K2>, K3>, K4> | NSV) => S
2236): C;
2237declare function updateIn<
2238 C,
2239 K: $KeyOf<C>,
2240 K2: $KeyOf<$ValOf<C, K>>,
2241 K3: $KeyOf<$ValOf<$ValOf<C, K>, K2>>,
2242 K4: $KeyOf<$ValOf<$ValOf<$ValOf<C, K>, K2>, K3>>,
2243 S: $ValOf<$ValOf<$ValOf<$ValOf<C, K>, K2>, K3>, K4>
2244>(
2245 collection: C,
2246 keyPath: [K, K2, K3, K4],
2247 updater: (value: $ValOf<$ValOf<$ValOf<$ValOf<C, K>, K2>, K3>, K4>) => S
2248): C;
2249declare function updateIn<
2250 C,
2251 K: $KeyOf<C>,
2252 K2: $KeyOf<$ValOf<C, K>>,
2253 K3: $KeyOf<$ValOf<$ValOf<C, K>, K2>>,
2254 K4: $KeyOf<$ValOf<$ValOf<$ValOf<C, K>, K2>, K3>>,
2255 K5: $KeyOf<$ValOf<$ValOf<$ValOf<$ValOf<C, K>, K2>, K3>, K4>>,
2256 S: $ValOf<$ValOf<$ValOf<$ValOf<$ValOf<C, K>, K2>, K3>, K4>, K5>,
2257 NSV
2258>(
2259 collection: C,
2260 keyPath: [K, K2, K3, K4, K5],
2261 notSetValue: NSV,
2262 updater: (
2263 value: $ValOf<$ValOf<$ValOf<$ValOf<$ValOf<C, K>, K2>, K3>, K4>, K5> | NSV
2264 ) => S
2265): C;
2266declare function updateIn<
2267 C,
2268 K: $KeyOf<C>,
2269 K2: $KeyOf<$ValOf<C, K>>,
2270 K3: $KeyOf<$ValOf<$ValOf<C, K>, K2>>,
2271 K4: $KeyOf<$ValOf<$ValOf<$ValOf<C, K>, K2>, K3>>,
2272 K5: $KeyOf<$ValOf<$ValOf<$ValOf<$ValOf<C, K>, K2>, K3>, K4>>,
2273 S: $ValOf<$ValOf<$ValOf<$ValOf<$ValOf<C, K>, K2>, K3>, K4>, K5>
2274>(
2275 collection: C,
2276 keyPath: [K, K2, K3, K4, K5],
2277 updater: (
2278 value: $ValOf<$ValOf<$ValOf<$ValOf<$ValOf<C, K>, K2>, K3>, K4>, K5>
2279 ) => S
2280): C;
2281
2282declare function merge<C>(
2283 collection: C,
2284 ...collections: Array<
2285 | $IterableOf<C>
2286 | $Shape<RecordValues<C>>
2287 | PlainObjInput<$KeyOf<C>, $ValOf<C>>
2288 >
2289): C;
2290declare function mergeWith<C>(
2291 merger: (oldVal: $ValOf<C>, newVal: $ValOf<C>, key: $KeyOf<C>) => $ValOf<C>,
2292 collection: C,
2293 ...collections: Array<
2294 | $IterableOf<C>
2295 | $Shape<RecordValues<C>>
2296 | PlainObjInput<$KeyOf<C>, $ValOf<C>>
2297 >
2298): C;
2299declare function mergeDeep<C>(
2300 collection: C,
2301 ...collections: Array<
2302 | $IterableOf<C>
2303 | $Shape<RecordValues<C>>
2304 | PlainObjInput<$KeyOf<C>, $ValOf<C>>
2305 >
2306): C;
2307declare function mergeDeepWith<C>(
2308 merger: (oldVal: any, newVal: any, key: any) => mixed,
2309 collection: C,
2310 ...collections: Array<
2311 | $IterableOf<C>
2312 | $Shape<RecordValues<C>>
2313 | PlainObjInput<$KeyOf<C>, $ValOf<C>>
2314 >
2315): C;
2316
2317export {
2318 Collection,
2319 Seq,
2320 List,
2321 Map,
2322 OrderedMap,
2323 OrderedSet,
2324 Range,
2325 Repeat,
2326 Record,
2327 Set,
2328 Stack,
2329 fromJS,
2330 is,
2331 hash,
2332 isImmutable,
2333 isCollection,
2334 isKeyed,
2335 isIndexed,
2336 isAssociative,
2337 isOrdered,
2338 isRecord,
2339 isValueObject,
2340 get,
2341 has,
2342 remove,
2343 set,
2344 update,
2345 getIn,
2346 hasIn,
2347 removeIn,
2348 setIn,
2349 updateIn,
2350 merge,
2351 mergeWith,
2352 mergeDeep,
2353 mergeDeepWith,
2354};
2355
2356export default {
2357 Collection,
2358 Seq,
2359
2360 List,
2361 Map,
2362 OrderedMap,
2363 OrderedSet,
2364 PairSorting,
2365 Range,
2366 Repeat,
2367 Record,
2368 Set,
2369 Stack,
2370
2371 fromJS,
2372 is,
2373 hash,
2374
2375 isImmutable,
2376 isCollection,
2377 isKeyed,
2378 isIndexed,
2379 isAssociative,
2380 isOrdered,
2381 isRecord,
2382 isValueObject,
2383
2384 get,
2385 has,
2386 remove,
2387 set,
2388 update,
2389 getIn,
2390 hasIn,
2391 removeIn,
2392 setIn,
2393 updateIn,
2394 merge,
2395 mergeWith,
2396 mergeDeep,
2397 mergeDeepWith,
2398};
2399
2400export type {
2401 Comparator,
2402 KeyedCollection,
2403 IndexedCollection,
2404 SetCollection,
2405 KeyedSeq,
2406 IndexedSeq,
2407 SetSeq,
2408 RecordFactory,
2409 RecordOf,
2410 RecordInstance,
2411 ValueObject,
2412 $KeyOf,
2413 $ValOf,
2414};
Note: See TracBrowser for help on using the repository browser.