immutable 4.0.0-rc.1 → 4.0.0-rc.14

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