immutable.js.flow 58 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674
  1. /**
  2. * Copyright (c) 2014-present, Facebook, Inc.
  3. *
  4. * This source code is licensed under the MIT license found in the
  5. * LICENSE file in the root directory of this source tree.
  6. */
  7. /**
  8. * This file provides type definitions for use with the Flow type checker.
  9. *
  10. * An important caveat when using these definitions is that the types for
  11. * `Collection.Keyed`, `Collection.Indexed`, `Seq.Keyed`, and so on are stubs.
  12. * When referring to those types, you can get the proper definitions by
  13. * importing the types `KeyedCollection`, `IndexedCollection`, `KeyedSeq`, etc.
  14. * For example,
  15. *
  16. * import { Seq } from 'immutable'
  17. * import type { IndexedCollection, IndexedSeq } from 'immutable'
  18. *
  19. * const someSeq: IndexedSeq<number> = Seq.Indexed.of(1, 2, 3)
  20. *
  21. * function takesASeq<T, TS: IndexedCollection<T>>(iter: TS): TS {
  22. * return iter.butLast()
  23. * }
  24. *
  25. * takesASeq(someSeq)
  26. *
  27. * @flow strict
  28. */
  29. // Helper type that represents plain objects allowed as arguments to
  30. // some constructors and functions.
  31. type PlainObjInput<K, V> = {+[key: K]: V, __proto__: null};
  32. // Helper types to extract the "keys" and "values" use by the *In() methods.
  33. type $KeyOf<C> = $Call<
  34. & (<K>(?_Collection<K, mixed>) => K)
  35. & (<T>(?$ReadOnlyArray<T>) => number)
  36. & (<T>(?RecordInstance<T> | T) => $Keys<T>),
  37. C
  38. >;
  39. type $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. & (<V>(?{[any]: V}) => V),
  44. C,
  45. K
  46. >;
  47. type $IterableOf<C> = $Call<
  48. & (<V: Array<any> | IndexedCollection<any> | SetCollection<any>>(V) => Iterable<$ValOf<V>>)
  49. & (<V: KeyedCollection<any, any> | RecordInstance<any> | PlainObjInput<any, any>>(V) => Iterable<[$KeyOf<V>, $ValOf<V>]>),
  50. C
  51. >;
  52. declare class _Collection<K, +V> implements ValueObject {
  53. equals(other: mixed): boolean;
  54. hashCode(): number;
  55. get(key: K, ..._: []): V | void;
  56. get<NSV>(key: K, notSetValue: NSV): V | NSV;
  57. has(key: K): boolean;
  58. includes(value: V): boolean;
  59. contains(value: V): boolean;
  60. first<NSV>(notSetValue?: NSV): V | NSV;
  61. last<NSV>(notSetValue?: NSV): V | NSV;
  62. hasIn(keyPath: Iterable<mixed>): boolean;
  63. getIn(keyPath: [], notSetValue?: mixed): this;
  64. getIn<NSV>(keyPath: [K], notSetValue: NSV): V | NSV;
  65. getIn<NSV, K2: $KeyOf<V>>(keyPath: [K, K2], notSetValue: NSV): $ValOf<V, K2> | NSV;
  66. getIn<NSV, K2: $KeyOf<V>, K3: $KeyOf<$ValOf<V, K2>>>(keyPath: [K, K2, K3], notSetValue: NSV): $ValOf<$ValOf<V, K2>, K3> | NSV;
  67. getIn<NSV, K2: $KeyOf<V>, K3: $KeyOf<$ValOf<V, K2>>, K4: $KeyOf<$ValOf<$ValOf<V, K2>, K3>>>(keyPath: [K, K2, K3, K4], notSetValue: NSV): $ValOf<$ValOf<$ValOf<V, K2>, K3>, K4> | NSV;
  68. getIn<NSV, K2: $KeyOf<V>, K3: $KeyOf<$ValOf<V, K2>>, K4: $KeyOf<$ValOf<$ValOf<V, K2>, K3>>, K5: $KeyOf<$ValOf<$ValOf<$ValOf<V, K2>, K3>, K4>>>(keyPath: [K, K2, K3, K4, K5], notSetValue: NSV): $ValOf<$ValOf<$ValOf<$ValOf<V, K2>, K3>, K4>, K5> | NSV;
  69. update<U>(updater: (value: this) => U): U;
  70. toJS(): Array<any> | { [key: string]: mixed };
  71. toJSON(): Array<V> | { [key: string]: V };
  72. toArray(): Array<V> | Array<[K,V]>;
  73. toObject(): { [key: string]: V };
  74. toMap(): Map<K, V>;
  75. toOrderedMap(): OrderedMap<K, V>;
  76. toSet(): Set<V>;
  77. toOrderedSet(): OrderedSet<V>;
  78. toList(): List<V>;
  79. toStack(): Stack<V>;
  80. toSeq(): Seq<K, V>;
  81. toKeyedSeq(): KeyedSeq<K, V>;
  82. toIndexedSeq(): IndexedSeq<V>;
  83. toSetSeq(): SetSeq<V>;
  84. keys(): Iterator<K>;
  85. values(): Iterator<V>;
  86. entries(): Iterator<[K, V]>;
  87. keySeq(): IndexedSeq<K>;
  88. valueSeq(): IndexedSeq<V>;
  89. entrySeq(): IndexedSeq<[K, V]>;
  90. reverse(): this;
  91. sort(comparator?: (valueA: V, valueB: V) => number): this;
  92. sortBy<C>(
  93. comparatorValueMapper: (value: V, key: K, iter: this) => C,
  94. comparator?: (valueA: C, valueB: C) => number
  95. ): this;
  96. groupBy<G>(
  97. grouper: (value: V, key: K, iter: this) => G,
  98. context?: mixed
  99. ): KeyedSeq<G, this>;
  100. forEach(
  101. sideEffect: (value: V, key: K, iter: this) => any,
  102. context?: mixed
  103. ): number;
  104. slice(begin?: number, end?: number): this;
  105. rest(): this;
  106. butLast(): this;
  107. skip(amount: number): this;
  108. skipLast(amount: number): this;
  109. skipWhile(predicate: (value: V, key: K, iter: this) => mixed, context?: mixed): this;
  110. skipUntil(predicate: (value: V, key: K, iter: this) => mixed, context?: mixed): this;
  111. take(amount: number): this;
  112. takeLast(amount: number): this;
  113. takeWhile(predicate: (value: V, key: K, iter: this) => mixed, context?: mixed): this;
  114. takeUntil(predicate: (value: V, key: K, iter: this) => mixed, context?: mixed): this;
  115. filterNot(
  116. predicate: (value: V, key: K, iter: this) => mixed,
  117. context?: mixed
  118. ): this;
  119. reduce<R>(
  120. reducer: (reduction: R, value: V, key: K, iter: this) => R,
  121. initialReduction: R,
  122. context?: mixed,
  123. ): R;
  124. reduce<R>(
  125. reducer: (reduction: V | R, value: V, key: K, iter: this) => R
  126. ): R;
  127. reduceRight<R>(
  128. reducer: (reduction: R, value: V, key: K, iter: this) => R,
  129. initialReduction: R,
  130. context?: mixed,
  131. ): R;
  132. reduceRight<R>(
  133. reducer: (reduction: V | R, value: V, key: K, iter: this) => R
  134. ): R;
  135. every(predicate: (value: V, key: K, iter: this) => mixed, context?: mixed): boolean;
  136. some(predicate: (value: V, key: K, iter: this) => mixed, context?: mixed): boolean;
  137. join(separator?: string): string;
  138. isEmpty(): boolean;
  139. count(predicate?: (value: V, key: K, iter: this) => mixed, context?: mixed): number;
  140. countBy<G>(grouper: (value: V, key: K, iter: this) => G, context?: mixed): Map<G, number>;
  141. find<NSV>(
  142. predicate: (value: V, key: K, iter: this) => mixed,
  143. context?: mixed,
  144. notSetValue?: NSV
  145. ): V | NSV;
  146. findLast<NSV>(
  147. predicate: (value: V, key: K, iter: this) => mixed,
  148. context?: mixed,
  149. notSetValue?: NSV
  150. ): V | NSV;
  151. findEntry(predicate: (value: V, key: K, iter: this) => mixed): [K, V] | void;
  152. findLastEntry(predicate: (value: V, key: K, iter: this) => mixed): [K, V] | void;
  153. findKey(predicate: (value: V, key: K, iter: this) => mixed, context?: mixed): K | void;
  154. findLastKey(predicate: (value: V, key: K, iter: this) => mixed, context?: mixed): K | void;
  155. keyOf(searchValue: V): K | void;
  156. lastKeyOf(searchValue: V): K | void;
  157. max(comparator?: (valueA: V, valueB: V) => number): V;
  158. maxBy<C>(
  159. comparatorValueMapper: (value: V, key: K, iter: this) => C,
  160. comparator?: (valueA: C, valueB: C) => number
  161. ): V;
  162. min(comparator?: (valueA: V, valueB: V) => number): V;
  163. minBy<C>(
  164. comparatorValueMapper: (value: V, key: K, iter: this) => C,
  165. comparator?: (valueA: C, valueB: C) => number
  166. ): V;
  167. isSubset(iter: Iterable<V>): boolean;
  168. isSuperset(iter: Iterable<V>): boolean;
  169. }
  170. declare function isImmutable(maybeImmutable: mixed): boolean %checks(maybeImmutable instanceof Collection);
  171. declare function isCollection(maybeCollection: mixed): boolean %checks(maybeCollection instanceof Collection);
  172. declare function isKeyed(maybeKeyed: mixed): boolean %checks(maybeKeyed instanceof KeyedCollection);
  173. declare function isIndexed(maybeIndexed: mixed): boolean %checks(maybeIndexed instanceof IndexedCollection);
  174. declare function isAssociative(maybeAssociative: mixed): boolean %checks(
  175. maybeAssociative instanceof KeyedCollection ||
  176. maybeAssociative instanceof IndexedCollection
  177. );
  178. declare function isOrdered(maybeOrdered: mixed): boolean %checks(
  179. maybeOrdered instanceof IndexedCollection ||
  180. maybeOrdered instanceof OrderedMap ||
  181. maybeOrdered instanceof OrderedSet
  182. );
  183. declare function isValueObject(maybeValue: mixed): boolean;
  184. declare function isSeq(maybeSeq: any): boolean %checks(maybeSeq instanceof Seq);
  185. declare function isList(maybeList: any): boolean %checks(maybeList instanceof List);
  186. declare function isMap(maybeMap: any): boolean %checks(maybeMap instanceof Map);
  187. declare function isOrderedMap(maybeOrderedMap: any): boolean %checks(maybeOrderedMap instanceof OrderedMap);
  188. declare function isStack(maybeStack: any): boolean %checks(maybeStack instanceof Stack);
  189. declare function isSet(maybeSet: any): boolean %checks(maybeSet instanceof Set);
  190. declare function isOrderedSet(maybeOrderedSet: any): boolean %checks(maybeOrderedSet instanceof OrderedSet);
  191. declare function isRecord(maybeRecord: any): boolean %checks(maybeRecord instanceof Record);
  192. declare interface ValueObject {
  193. equals(other: mixed): boolean;
  194. hashCode(): number;
  195. }
  196. declare class Collection<K, +V> extends _Collection<K, V> {
  197. static Keyed: typeof KeyedCollection;
  198. static Indexed: typeof IndexedCollection;
  199. static Set: typeof SetCollection;
  200. static isCollection: typeof isCollection;
  201. static isKeyed: typeof isKeyed;
  202. static isIndexed: typeof isIndexed;
  203. static isAssociative: typeof isAssociative;
  204. static isOrdered: typeof isOrdered;
  205. }
  206. declare class KeyedCollection<K, +V> extends Collection<K, V> {
  207. static <K, V>(values?: Iterable<[K, V]> | PlainObjInput<K, V>): KeyedCollection<K, V>;
  208. toJS(): { [key: string]: mixed };
  209. toJSON(): { [key: string]: V };
  210. toArray(): Array<[K, V]>;
  211. @@iterator(): Iterator<[K, V]>;
  212. toSeq(): KeyedSeq<K, V>;
  213. flip(): KeyedCollection<V, K>;
  214. concat<KC, VC>(...iters: Array<Iterable<[KC, VC]> | PlainObjInput<KC, VC>>): KeyedCollection<K | KC, V | VC>;
  215. filter(predicate: typeof Boolean): KeyedCollection<K, $NonMaybeType<V>>;
  216. filter(
  217. predicate: (value: V, key: K, iter: this) => mixed,
  218. context?: mixed
  219. ): KeyedCollection<K, V>;
  220. map<M>(
  221. mapper: (value: V, key: K, iter: this) => M,
  222. context?: mixed
  223. ): KeyedCollection<K, M>;
  224. mapKeys<M>(
  225. mapper: (key: K, value: V, iter: this) => M,
  226. context?: mixed
  227. ): KeyedCollection<M, V>;
  228. mapEntries<KM, VM>(
  229. mapper: (entry: [K, V], index: number, iter: this) => [KM, VM],
  230. context?: mixed
  231. ): KeyedCollection<KM, VM>;
  232. flatMap<KM, VM>(
  233. mapper: (value: V, key: K, iter: this) => Iterable<[KM, VM]>,
  234. context?: mixed
  235. ): KeyedCollection<KM, VM>;
  236. flatten(depth?: number): KeyedCollection<any, any>;
  237. flatten(shallow?: boolean): KeyedCollection<any, any>;
  238. }
  239. Collection.Keyed = KeyedCollection
  240. declare class IndexedCollection<+T> extends Collection<number, T> {
  241. static <T>(iter?: Iterable<T>): IndexedCollection<T>;
  242. toJS(): Array<mixed>;
  243. toJSON(): Array<T>;
  244. toArray(): Array<T>;
  245. @@iterator(): Iterator<T>;
  246. toSeq(): IndexedSeq<T>;
  247. fromEntrySeq<K, V>(): KeyedSeq<K, V>;
  248. interpose(separator: T): this;
  249. interleave(...collections: Iterable<T>[]): this;
  250. splice(
  251. index: number,
  252. removeNum: number,
  253. ...values: T[]
  254. ): this;
  255. zip<A>(
  256. a: Iterable<A>,
  257. ..._: []
  258. ): IndexedCollection<[T, A]>;
  259. zip<A, B>(
  260. a: Iterable<A>,
  261. b: Iterable<B>,
  262. ..._: []
  263. ): IndexedCollection<[T, A, B]>;
  264. zip<A, B, C>(
  265. a: Iterable<A>,
  266. b: Iterable<B>,
  267. c: Iterable<C>,
  268. ..._: []
  269. ): IndexedCollection<[T, A, B, C]>;
  270. zip<A, B, C, D>(
  271. a: Iterable<A>,
  272. b: Iterable<B>,
  273. c: Iterable<C>,
  274. d: Iterable<D>,
  275. ..._: []
  276. ): IndexedCollection<[T, A, B, C, D]>;
  277. zip<A, B, C, D, E>(
  278. a: Iterable<A>,
  279. b: Iterable<B>,
  280. c: Iterable<C>,
  281. d: Iterable<D>,
  282. e: Iterable<E>,
  283. ..._: []
  284. ): IndexedCollection<[T, A, B, C, D, E]>;
  285. zipAll<A>(
  286. a: Iterable<A>,
  287. ..._: []
  288. ): IndexedCollection<[T|void, A|void]>;
  289. zipAll<A, B>(
  290. a: Iterable<A>,
  291. b: Iterable<B>,
  292. ..._: []
  293. ): IndexedCollection<[T|void, A|void, B|void]>;
  294. zipAll<A, B, C>(
  295. a: Iterable<A>,
  296. b: Iterable<B>,
  297. c: Iterable<C>,
  298. ..._: []
  299. ): IndexedCollection<[T|void, A|void, B|void, C|void]>;
  300. zipAll<A, B, C, D>(
  301. a: Iterable<A>,
  302. b: Iterable<B>,
  303. c: Iterable<C>,
  304. d: Iterable<D>,
  305. ..._: []
  306. ): IndexedCollection<[T|void, A|void, B|void, C|void, D|void]>;
  307. zipAll<A, B, C, D, E>(
  308. a: Iterable<A>,
  309. b: Iterable<B>,
  310. c: Iterable<C>,
  311. d: Iterable<D>,
  312. e: Iterable<E>,
  313. ..._: []
  314. ): IndexedCollection<[T|void, A|void, B|void, C|void, D|void, E|void]>;
  315. zipWith<A, R>(
  316. zipper: (value: T, a: A) => R,
  317. a: Iterable<A>,
  318. ..._: []
  319. ): IndexedCollection<R>;
  320. zipWith<A, B, R>(
  321. zipper: (value: T, a: A, b: B) => R,
  322. a: Iterable<A>,
  323. b: Iterable<B>,
  324. ..._: []
  325. ): IndexedCollection<R>;
  326. zipWith<A, B, C, R>(
  327. zipper: (value: T, a: A, b: B, c: C) => R,
  328. a: Iterable<A>,
  329. b: Iterable<B>,
  330. c: Iterable<C>,
  331. ..._: []
  332. ): IndexedCollection<R>;
  333. zipWith<A, B, C, D, R>(
  334. zipper: (value: T, a: A, b: B, c: C, d: D) => R,
  335. a: Iterable<A>,
  336. b: Iterable<B>,
  337. c: Iterable<C>,
  338. d: Iterable<D>,
  339. ..._: []
  340. ): IndexedCollection<R>;
  341. zipWith<A, B, C, D, E, R>(
  342. zipper: (value: T, a: A, b: B, c: C, d: D, e: E) => R,
  343. a: Iterable<A>,
  344. b: Iterable<B>,
  345. c: Iterable<C>,
  346. d: Iterable<D>,
  347. e: Iterable<E>,
  348. ..._: []
  349. ): IndexedCollection<R>;
  350. indexOf(searchValue: T): number;
  351. lastIndexOf(searchValue: T): number;
  352. findIndex(
  353. predicate: (value: T, index: number, iter: this) => mixed,
  354. context?: mixed
  355. ): number;
  356. findLastIndex(
  357. predicate: (value: T, index: number, iter: this) => mixed,
  358. context?: mixed
  359. ): number;
  360. concat<C>(...iters: Array<Iterable<C> | C>): IndexedCollection<T | C>;
  361. filter(predicate: typeof Boolean): IndexedCollection<$NonMaybeType<T>>;
  362. filter(
  363. predicate: (value: T, index: number, iter: this) => mixed,
  364. context?: mixed
  365. ): IndexedCollection<T>;
  366. map<M>(
  367. mapper: (value: T, index: number, iter: this) => M,
  368. context?: mixed
  369. ): IndexedCollection<M>;
  370. flatMap<M>(
  371. mapper: (value: T, index: number, iter: this) => Iterable<M>,
  372. context?: mixed
  373. ): IndexedCollection<M>;
  374. flatten(depth?: number): IndexedCollection<any>;
  375. flatten(shallow?: boolean): IndexedCollection<any>;
  376. }
  377. declare class SetCollection<+T> extends Collection<T, T> {
  378. static <T>(iter?: Iterable<T>): SetCollection<T>;
  379. toJS(): Array<mixed>;
  380. toJSON(): Array<T>;
  381. toArray(): Array<T>;
  382. @@iterator(): Iterator<T>;
  383. toSeq(): SetSeq<T>;
  384. concat<U>(...collections: Iterable<U>[]): SetCollection<T | U>;
  385. // `filter`, `map` and `flatMap` cannot be defined further up the hierarchy,
  386. // because the implementation for `KeyedCollection` allows the value type to
  387. // change without constraining the key type. That does not work for
  388. // `SetCollection` - the value and key types *must* match.
  389. filter(predicate: typeof Boolean): SetCollection<$NonMaybeType<T>>;
  390. filter(
  391. predicate: (value: T, value: T, iter: this) => mixed,
  392. context?: mixed
  393. ): SetCollection<T>;
  394. map<M>(
  395. mapper: (value: T, value: T, iter: this) => M,
  396. context?: mixed
  397. ): SetCollection<M>;
  398. flatMap<M>(
  399. mapper: (value: T, value: T, iter: this) => Iterable<M>,
  400. context?: mixed
  401. ): SetCollection<M>;
  402. flatten(depth?: number): SetCollection<any>;
  403. flatten(shallow?: boolean): SetCollection<any>;
  404. }
  405. declare function isSeq(maybeSeq: mixed): boolean %checks(maybeSeq instanceof Seq);
  406. declare class Seq<K, +V> extends _Collection<K, V> {
  407. static Keyed: typeof KeyedSeq;
  408. static Indexed: typeof IndexedSeq;
  409. static Set: typeof SetSeq;
  410. static <K, V>(values: KeyedSeq<K, V>): KeyedSeq<K, V>;
  411. static <T>(values: SetSeq<T>): SetSeq<K, V>;
  412. static <T>(values: Iterable<T>): IndexedSeq<T>;
  413. static <K, V>(values?: PlainObjInput<K, V>): KeyedSeq<K, V>;
  414. static isSeq: typeof isSeq;
  415. size: number | void;
  416. cacheResult(): this;
  417. toSeq(): this;
  418. }
  419. declare class KeyedSeq<K, +V> extends Seq<K, V> mixins KeyedCollection<K, V> {
  420. static <K, V>(values?: Iterable<[K, V]> | PlainObjInput<K, V>): KeyedSeq<K, V>;
  421. // Override specialized return types
  422. flip(): KeyedSeq<V, K>;
  423. concat<KC, VC>(...iters: Array<Iterable<[KC, VC]> | PlainObjInput<KC, VC>>): KeyedSeq<K | KC, V | VC>;
  424. filter(predicate: typeof Boolean): KeyedSeq<K, $NonMaybeType<V>>;
  425. filter(
  426. predicate: (value: V, key: K, iter: this) => mixed,
  427. context?: mixed
  428. ): KeyedSeq<K, V>;
  429. map<M>(
  430. mapper: (value: V, key: K, iter: this) => M,
  431. context?: mixed
  432. ): KeyedSeq<K, M>;
  433. mapKeys<M>(
  434. mapper: (key: K, value: V, iter: this) => M,
  435. context?: mixed
  436. ): KeyedSeq<M, V>;
  437. mapEntries<KM, VM>(
  438. mapper: (entry: [K, V], index: number, iter: this) => [KM, VM],
  439. context?: mixed
  440. ): KeyedSeq<KM, VM>;
  441. flatMap<KM, VM>(
  442. mapper: (value: V, key: K, iter: this) => Iterable<[KM, VM]>,
  443. context?: mixed
  444. ): KeyedSeq<KM, VM>;
  445. flatten(depth?: number): KeyedSeq<any, any>;
  446. flatten(shallow?: boolean): KeyedSeq<any, any>;
  447. }
  448. declare class IndexedSeq<+T> extends Seq<number, T> mixins IndexedCollection<T> {
  449. static <T>(values?: Iterable<T>): IndexedSeq<T>;
  450. static of<T>(...values: T[]): IndexedSeq<T>;
  451. // Override specialized return types
  452. concat<C>(...iters: Array<Iterable<C> | C>): IndexedSeq<T | C>;
  453. filter(predicate: typeof Boolean): IndexedSeq<$NonMaybeType<T>>;
  454. filter(
  455. predicate: (value: T, index: number, iter: this) => mixed,
  456. context?: mixed
  457. ): IndexedSeq<T>;
  458. map<M>(
  459. mapper: (value: T, index: number, iter: this) => M,
  460. context?: mixed
  461. ): IndexedSeq<M>;
  462. flatMap<M>(
  463. mapper: (value: T, index: number, iter: this) => Iterable<M>,
  464. context?: mixed
  465. ): IndexedSeq<M>;
  466. flatten(depth?: number): IndexedSeq<any>;
  467. flatten(shallow?: boolean): IndexedSeq<any>;
  468. zip<A>(
  469. a: Iterable<A>,
  470. ..._: []
  471. ): IndexedSeq<[T, A]>;
  472. zip<A, B>(
  473. a: Iterable<A>,
  474. b: Iterable<B>,
  475. ..._: []
  476. ): IndexedSeq<[T, A, B]>;
  477. zip<A, B, C>(
  478. a: Iterable<A>,
  479. b: Iterable<B>,
  480. c: Iterable<C>,
  481. ..._: []
  482. ): IndexedSeq<[T, A, B, C]>;
  483. zip<A, B, C, D>(
  484. a: Iterable<A>,
  485. b: Iterable<B>,
  486. c: Iterable<C>,
  487. d: Iterable<D>,
  488. ..._: []
  489. ): IndexedSeq<[T, A, B, C, D]>;
  490. zip<A, B, C, D, E>(
  491. a: Iterable<A>,
  492. b: Iterable<B>,
  493. c: Iterable<C>,
  494. d: Iterable<D>,
  495. e: Iterable<E>,
  496. ..._: []
  497. ): IndexedSeq<[T, A, B, C, D, E]>;
  498. zipAll<A>(
  499. a: Iterable<A>,
  500. ..._: []
  501. ): IndexedSeq<[T|void, A|void]>;
  502. zipAll<A, B>(
  503. a: Iterable<A>,
  504. b: Iterable<B>,
  505. ..._: []
  506. ): IndexedSeq<[T|void, A|void, B|void]>;
  507. zipAll<A, B, C>(
  508. a: Iterable<A>,
  509. b: Iterable<B>,
  510. c: Iterable<C>,
  511. ..._: []
  512. ): IndexedSeq<[T|void, A|void, B|void, C|void]>;
  513. zipAll<A, B, C, D>(
  514. a: Iterable<A>,
  515. b: Iterable<B>,
  516. c: Iterable<C>,
  517. d: Iterable<D>,
  518. ..._: []
  519. ): IndexedSeq<[T|void, A|void, B|void, C|void, D|void]>;
  520. zipAll<A, B, C, D, E>(
  521. a: Iterable<A>,
  522. b: Iterable<B>,
  523. c: Iterable<C>,
  524. d: Iterable<D>,
  525. e: Iterable<E>,
  526. ..._: []
  527. ): IndexedSeq<[T|void, A|void, B|void, C|void, D|void, E|void]>;
  528. zipWith<A, R>(
  529. zipper: (value: T, a: A) => R,
  530. a: Iterable<A>,
  531. ..._: []
  532. ): IndexedSeq<R>;
  533. zipWith<A, B, R>(
  534. zipper: (value: T, a: A, b: B) => R,
  535. a: Iterable<A>,
  536. b: Iterable<B>,
  537. ..._: []
  538. ): IndexedSeq<R>;
  539. zipWith<A, B, C, R>(
  540. zipper: (value: T, a: A, b: B, c: C) => R,
  541. a: Iterable<A>,
  542. b: Iterable<B>,
  543. c: Iterable<C>,
  544. ..._: []
  545. ): IndexedSeq<R>;
  546. zipWith<A, B, C, D, R>(
  547. zipper: (value: T, a: A, b: B, c: C, d: D) => R,
  548. a: Iterable<A>,
  549. b: Iterable<B>,
  550. c: Iterable<C>,
  551. d: Iterable<D>,
  552. ..._: []
  553. ): IndexedSeq<R>;
  554. zipWith<A, B, C, D, E, R>(
  555. zipper: (value: T, a: A, b: B, c: C, d: D, e: E) => R,
  556. a: Iterable<A>,
  557. b: Iterable<B>,
  558. c: Iterable<C>,
  559. d: Iterable<D>,
  560. e: Iterable<E>,
  561. ..._: []
  562. ): IndexedSeq<R>;
  563. }
  564. declare class SetSeq<+T> extends Seq<T, T> mixins SetCollection<T> {
  565. static <T>(values?: Iterable<T>): SetSeq<T>;
  566. static of<T>(...values: T[]): SetSeq<T>;
  567. // Override specialized return types
  568. concat<U>(...collections: Iterable<U>[]): SetSeq<T | U>;
  569. filter(predicate: typeof Boolean): SetSeq<$NonMaybeType<T>>;
  570. filter(
  571. predicate: (value: T, value: T, iter: this) => mixed,
  572. context?: mixed
  573. ): SetSeq<T>;
  574. map<M>(
  575. mapper: (value: T, value: T, iter: this) => M,
  576. context?: mixed
  577. ): SetSeq<M>;
  578. flatMap<M>(
  579. mapper: (value: T, value: T, iter: this) => Iterable<M>,
  580. context?: mixed
  581. ): SetSeq<M>;
  582. flatten(depth?: number): SetSeq<any>;
  583. flatten(shallow?: boolean): SetSeq<any>;
  584. }
  585. declare class UpdatableInCollection<K, +V> {
  586. setIn<S>(keyPath: [], value: S): S;
  587. setIn(keyPath: [K], value: V): this;
  588. setIn<K2: $KeyOf<V>, S: $ValOf<V, K2>>(keyPath: [K, K2], value: S): this;
  589. setIn<K2: $KeyOf<V>, K3: $KeyOf<$ValOf<V, K2>>, S: $ValOf<$ValOf<V, K2>, K3>>(keyPath: [K, K2, K3], value: S): this;
  590. setIn<K2: $KeyOf<V>, K3: $KeyOf<$ValOf<V, K2>>, K4: $KeyOf<$ValOf<$ValOf<V, K2>, K3>>, S: $ValOf<$ValOf<$ValOf<V, K2>, K3>, K4>>(keyPath: [K, K2, K3, K4], value: S): this;
  591. setIn<K2: $KeyOf<V>, K3: $KeyOf<$ValOf<V, K2>>, K4: $KeyOf<$ValOf<$ValOf<V, K2>, K3>>, K5: $KeyOf<$ValOf<$ValOf<$ValOf<V, K2>, K3>, K4>>, S: $ValOf<$ValOf<$ValOf<$ValOf<V, K2>, K3>, K4>, K5>>(keyPath: [K, K2, K3, K4, K5], value: S): this;
  592. deleteIn(keyPath: []): void;
  593. deleteIn(keyPath: [K]): this;
  594. deleteIn<K2: $KeyOf<V>>(keyPath: [K, K2]): this;
  595. deleteIn<K2: $KeyOf<V>, K3: $KeyOf<$ValOf<V, K2>>>(keyPath: [K, K2, K3]): this;
  596. deleteIn<K2: $KeyOf<V>, K3: $KeyOf<$ValOf<V, K2>>, K4: $KeyOf<$ValOf<$ValOf<V, K2>, K3>>>(keyPath: [K, K2, K3, K4]): this;
  597. deleteIn<K2: $KeyOf<V>, K3: $KeyOf<$ValOf<V, K2>>, K4: $KeyOf<$ValOf<$ValOf<V, K2>, K3>>, K5: $KeyOf<$ValOf<$ValOf<$ValOf<V, K2>, K3>, K4>>>(keyPath: [K, K2, K3, K4, K5]): this;
  598. removeIn(keyPath: []): void;
  599. removeIn(keyPath: [K]): this;
  600. removeIn<K2: $KeyOf<V>>(keyPath: [K, K2]): this;
  601. removeIn<K2: $KeyOf<V>, K3: $KeyOf<$ValOf<V, K2>>>(keyPath: [K, K2, K3]): this;
  602. removeIn<K2: $KeyOf<V>, K3: $KeyOf<$ValOf<V, K2>>, K4: $KeyOf<$ValOf<$ValOf<V, K2>, K3>>>(keyPath: [K, K2, K3, K4]): this;
  603. removeIn<K2: $KeyOf<V>, K3: $KeyOf<$ValOf<V, K2>>, K4: $KeyOf<$ValOf<$ValOf<V, K2>, K3>>, K5: $KeyOf<$ValOf<$ValOf<$ValOf<V, K2>, K3>, K4>>>(keyPath: [K, K2, K3, K4, K5]): this;
  604. updateIn<U>(keyPath: [], notSetValue: mixed, updater: (value: this) => U): U;
  605. updateIn<U>(keyPath: [], updater: (value: this) => U): U;
  606. updateIn<NSV>(keyPath: [K], notSetValue: NSV, updater: (value: V) => V): this;
  607. updateIn(keyPath: [K], updater: (value: V) => V): this;
  608. updateIn<NSV, K2: $KeyOf<V>, S: $ValOf<V, K2>>(keyPath: [K, K2], notSetValue: NSV, updater: (value: $ValOf<V, K2> | NSV) => S): this;
  609. updateIn<K2: $KeyOf<V>, S: $ValOf<V, K2>>(keyPath: [K, K2], updater: (value: $ValOf<V, K2>) => S): this;
  610. updateIn<NSV, K2: $KeyOf<V>, K3: $KeyOf<$ValOf<V, K2>>, S: $ValOf<$ValOf<V, K2>, K3>>(keyPath: [K, K2, K3], notSetValue: NSV, updater: (value: $ValOf<$ValOf<V, K2>, K3> | NSV) => S): this;
  611. updateIn<K2: $KeyOf<V>, K3: $KeyOf<$ValOf<V, K2>>, S: $ValOf<$ValOf<V, K2>, K3>>(keyPath: [K, K2, K3], updater: (value: $ValOf<$ValOf<V, K2>, K3>) => S): this;
  612. updateIn<NSV, K2: $KeyOf<V>, K3: $KeyOf<$ValOf<V, K2>>, K4: $KeyOf<$ValOf<$ValOf<V, K2>, K3>>, S: $ValOf<$ValOf<$ValOf<V, K2>, K3>, K4>>(keyPath: [K, K2, K3, K4], notSetValue: NSV, updater: (value: $ValOf<$ValOf<$ValOf<V, K2>, K3>, K4> | NSV) => S): this;
  613. updateIn<K2: $KeyOf<V>, K3: $KeyOf<$ValOf<V, K2>>, K4: $KeyOf<$ValOf<$ValOf<V, K2>, K3>>, S: $ValOf<$ValOf<$ValOf<V, K2>, K3>, K4>>(keyPath: [K, K2, K3, K4], updater: (value: $ValOf<$ValOf<$ValOf<V, K2>, K3>, K4>) => S): this;
  614. updateIn<NSV, K2: $KeyOf<V>, K3: $KeyOf<$ValOf<V, K2>>, K4: $KeyOf<$ValOf<$ValOf<V, K2>, K3>>, K5: $KeyOf<$ValOf<$ValOf<$ValOf<V, K2>, K3>, K4>>, S: $ValOf<$ValOf<$ValOf<$ValOf<V, K2>, K3>, K4>, K5>>(keyPath: [K, K2, K3, K4, K5], notSetValue: NSV, updater: (value: $ValOf<$ValOf<$ValOf<$ValOf<V, K2>, K3>, K4>, K5> | NSV) => S): this;
  615. updateIn<K2: $KeyOf<V>, K3: $KeyOf<$ValOf<V, K2>>, K4: $KeyOf<$ValOf<$ValOf<V, K2>, K3>>, K5: $KeyOf<$ValOf<$ValOf<$ValOf<V, K2>, K3>, K4>>, S: $ValOf<$ValOf<$ValOf<$ValOf<V, K2>, K3>, K4>, K5>>(keyPath: [K, K2, K3, K4, K5], updater: (value: $ValOf<$ValOf<$ValOf<$ValOf<V, K2>, K3>, K4>, K5>) => S): this;
  616. }
  617. declare function isList(maybeList: mixed): boolean %checks(maybeList instanceof List);
  618. declare class List<+T> extends IndexedCollection<T> mixins UpdatableInCollection<number, T> {
  619. static (collection?: Iterable<T>): List<T>;
  620. static of<T>(...values: T[]): List<T>;
  621. static isList: typeof isList;
  622. size: number;
  623. set<U>(index: number, value: U): List<T | U>;
  624. delete(index: number): this;
  625. remove(index: number): this;
  626. insert<U>(index: number, value: U): List<T | U>;
  627. clear(): this;
  628. push<U>(...values: U[]): List<T | U>;
  629. pop(): this;
  630. unshift<U>(...values: U[]): List<T | U>;
  631. shift(): this;
  632. update<U>(updater: (value: this) => U): U;
  633. update<U>(index: number, updater: (value: T) => U): List<T | U>;
  634. update<U>(index: number, notSetValue: U, updater: (value: T) => U): List<T | U>;
  635. merge<U>(...collections: Iterable<U>[]): List<T | U>;
  636. setSize(size: number): this;
  637. mergeIn(keyPath: Iterable<mixed>, ...collections: Iterable<mixed>[]): this;
  638. mergeDeepIn(keyPath: Iterable<mixed>, ...collections: Iterable<mixed>[]): this;
  639. withMutations(mutator: (mutable: this) => mixed): this;
  640. asMutable(): this;
  641. wasAltered(): boolean;
  642. asImmutable(): this;
  643. // Override specialized return types
  644. concat<C>(...iters: Array<Iterable<C> | C>): List<T | C>;
  645. filter(predicate: typeof Boolean): List<$NonMaybeType<T>>;
  646. filter(
  647. predicate: (value: T, index: number, iter: this) => mixed,
  648. context?: mixed
  649. ): List<T>;
  650. map<M>(
  651. mapper: (value: T, index: number, iter: this) => M,
  652. context?: mixed
  653. ): List<M>;
  654. flatMap<M>(
  655. mapper: (value: T, index: number, iter: this) => Iterable<M>,
  656. context?: mixed
  657. ): List<M>;
  658. flatten(depth?: number): List<any>;
  659. flatten(shallow?: boolean): List<any>;
  660. zip<A>(
  661. a: Iterable<A>,
  662. ..._: []
  663. ): List<[T, A]>;
  664. zip<A, B>(
  665. a: Iterable<A>,
  666. b: Iterable<B>,
  667. ..._: []
  668. ): List<[T, A, B]>;
  669. zip<A, B, C>(
  670. a: Iterable<A>,
  671. b: Iterable<B>,
  672. c: Iterable<C>,
  673. ..._: []
  674. ): List<[T, A, B, C]>;
  675. zip<A, B, C, D>(
  676. a: Iterable<A>,
  677. b: Iterable<B>,
  678. c: Iterable<C>,
  679. d: Iterable<D>,
  680. ..._: []
  681. ): List<[T, A, B, C, D]>;
  682. zip<A, B, C, D, E>(
  683. a: Iterable<A>,
  684. b: Iterable<B>,
  685. c: Iterable<C>,
  686. d: Iterable<D>,
  687. e: Iterable<E>,
  688. ..._: []
  689. ): List<[T, A, B, C, D, E]>;
  690. zipAll<A>(
  691. a: Iterable<A>,
  692. ..._: []
  693. ): List<[T|void, A|void]>;
  694. zipAll<A, B>(
  695. a: Iterable<A>,
  696. b: Iterable<B>,
  697. ..._: []
  698. ): List<[T|void, A|void, B|void]>;
  699. zipAll<A, B, C>(
  700. a: Iterable<A>,
  701. b: Iterable<B>,
  702. c: Iterable<C>,
  703. ..._: []
  704. ): List<[T|void, A|void, B|void, C|void]>;
  705. zipAll<A, B, C, D>(
  706. a: Iterable<A>,
  707. b: Iterable<B>,
  708. c: Iterable<C>,
  709. d: Iterable<D>,
  710. ..._: []
  711. ): List<[T|void, A|void, B|void, C|void, D|void]>;
  712. zipAll<A, B, C, D, E>(
  713. a: Iterable<A>,
  714. b: Iterable<B>,
  715. c: Iterable<C>,
  716. d: Iterable<D>,
  717. e: Iterable<E>,
  718. ..._: []
  719. ): List<[T|void, A|void, B|void, C|void, D|void, E|void]>;
  720. zipWith<A, R>(
  721. zipper: (value: T, a: A) => R,
  722. a: Iterable<A>,
  723. ..._: []
  724. ): List<R>;
  725. zipWith<A, B, R>(
  726. zipper: (value: T, a: A, b: B) => R,
  727. a: Iterable<A>,
  728. b: Iterable<B>,
  729. ..._: []
  730. ): List<R>;
  731. zipWith<A, B, C, R>(
  732. zipper: (value: T, a: A, b: B, c: C) => R,
  733. a: Iterable<A>,
  734. b: Iterable<B>,
  735. c: Iterable<C>,
  736. ..._: []
  737. ): List<R>;
  738. zipWith<A, B, C, D, R>(
  739. zipper: (value: T, a: A, b: B, c: C, d: D) => R,
  740. a: Iterable<A>,
  741. b: Iterable<B>,
  742. c: Iterable<C>,
  743. d: Iterable<D>,
  744. ..._: []
  745. ): List<R>;
  746. zipWith<A, B, C, D, E, R>(
  747. zipper: (value: T, a: A, b: B, c: C, d: D, e: E) => R,
  748. a: Iterable<A>,
  749. b: Iterable<B>,
  750. c: Iterable<C>,
  751. d: Iterable<D>,
  752. e: Iterable<E>,
  753. ..._: []
  754. ): List<R>;
  755. }
  756. declare function isMap(maybeMap: mixed): boolean %checks(maybeMap instanceof Map);
  757. declare class Map<K, +V> extends KeyedCollection<K, V> mixins UpdatableInCollection<K, V> {
  758. static <K, V>(values?: Iterable<[K, V]> | PlainObjInput<K, V>): Map<K, V>;
  759. static isMap: typeof isMap;
  760. size: number;
  761. set<K_, V_>(key: K_, value: V_): Map<K | K_, V | V_>;
  762. delete(key: K): this;
  763. remove(key: K): this;
  764. clear(): this;
  765. deleteAll(keys: Iterable<K>): Map<K, V>;
  766. removeAll(keys: Iterable<K>): Map<K, V>;
  767. update<U>(updater: (value: this) => U): U;
  768. update<V_>(key: K, updater: (value: V) => V_): Map<K, V | V_>;
  769. update<V_>(key: K, notSetValue: V_, updater: (value: V) => V_): Map<K, V | V_>;
  770. merge<K_, V_>(
  771. ...collections: (Iterable<[K_, V_]> | PlainObjInput<K_, V_>)[]
  772. ): Map<K | K_, V | V_>;
  773. concat<K_, V_>(
  774. ...collections: (Iterable<[K_, V_]> | PlainObjInput<K_, V_>)[]
  775. ): Map<K | K_, V | V_>;
  776. mergeWith<K_, W, X>(
  777. merger: (oldVal: V, newVal: W, key: K) => X,
  778. ...collections: (Iterable<[K_, W]> | PlainObjInput<K_, W>)[]
  779. ): Map<K | K_, V | W | X>;
  780. mergeDeep<K_, V_>(
  781. ...collections: (Iterable<[K_, V_]> | PlainObjInput<K_, V_>)[]
  782. ): Map<K | K_, V | V_>;
  783. mergeDeepWith<K_, V_>(
  784. merger: (oldVal: any, newVal: any, key: any) => mixed,
  785. ...collections: (Iterable<[K_, V_]> | PlainObjInput<K_, V_>)[]
  786. ): Map<K | K_, V | V_>;
  787. mergeIn(
  788. keyPath: Iterable<mixed>,
  789. ...collections: (Iterable<mixed> | PlainObjInput<mixed, mixed>)[]
  790. ): this;
  791. mergeDeepIn(
  792. keyPath: Iterable<mixed>,
  793. ...collections: (Iterable<mixed> | PlainObjInput<mixed, mixed>)[]
  794. ): this;
  795. withMutations(mutator: (mutable: this) => mixed): this;
  796. asMutable(): this;
  797. wasAltered(): boolean;
  798. asImmutable(): this;
  799. // Override specialized return types
  800. flip(): Map<V, K>;
  801. filter(predicate: typeof Boolean): Map<K, $NonMaybeType<V>>;
  802. filter(
  803. predicate: (value: V, key: K, iter: this) => mixed,
  804. context?: mixed
  805. ): Map<K, V>;
  806. map<M>(
  807. mapper: (value: V, key: K, iter: this) => M,
  808. context?: mixed
  809. ): Map<K, M>;
  810. mapKeys<M>(
  811. mapper: (key: K, value: V, iter: this) => M,
  812. context?: mixed
  813. ): Map<M, V>;
  814. mapEntries<KM, VM>(
  815. mapper: (entry: [K, V], index: number, iter: this) => [KM, VM],
  816. context?: mixed
  817. ): Map<KM, VM>;
  818. flatMap<KM, VM>(
  819. mapper: (value: V, key: K, iter: this) => Iterable<[KM, VM]>,
  820. context?: mixed
  821. ): Map<KM, VM>;
  822. flatten(depth?: number): Map<any, any>;
  823. flatten(shallow?: boolean): Map<any, any>;
  824. }
  825. declare function isOrderedMap(maybeOrderedMap: mixed): boolean %checks(maybeOrderedMap instanceof OrderedMap);
  826. declare class OrderedMap<K, +V> extends Map<K, V> mixins UpdatableInCollection<K, V> {
  827. static <K, V>(values?: Iterable<[K, V]> | PlainObjInput<K, V>): OrderedMap<K, V>;
  828. static isOrderedMap: typeof isOrderedMap;
  829. size: number;
  830. set<K_, V_>(key: K_, value: V_): OrderedMap<K | K_, V | V_>;
  831. delete(key: K): this;
  832. remove(key: K): this;
  833. clear(): this;
  834. update<U>(updater: (value: this) => U): U;
  835. update<V_>(key: K, updater: (value: V) => V_): OrderedMap<K, V | V_>;
  836. update<V_>(key: K, notSetValue: V_, updater: (value: V) => V_): OrderedMap<K, V | V_>;
  837. merge<K_, V_>(
  838. ...collections: (Iterable<[K_, V_]> | PlainObjInput<K_, V_>)[]
  839. ): OrderedMap<K | K_, V | V_>;
  840. concat<K_, V_>(
  841. ...collections: (Iterable<[K_, V_]> | PlainObjInput<K_, V_>)[]
  842. ): OrderedMap<K | K_, V | V_>;
  843. mergeWith<K_, W, X>(
  844. merger: (oldVal: V, newVal: W, key: K) => X,
  845. ...collections: (Iterable<[K_, W]> | PlainObjInput<K_, W>)[]
  846. ): OrderedMap<K | K_, V | W | X>;
  847. mergeDeep<K_, V_>(
  848. ...collections: (Iterable<[K_, V_]> | PlainObjInput<K_, V_>)[]
  849. ): OrderedMap<K | K_, V | V_>;
  850. mergeDeepWith<K_, V_>(
  851. merger: (oldVal: any, newVal: any, key: any) => mixed,
  852. ...collections: (Iterable<[K_, V_]> | PlainObjInput<K_, V_>)[]
  853. ): OrderedMap<K | K_, V | V_>;
  854. mergeIn(
  855. keyPath: Iterable<mixed>,
  856. ...collections: (Iterable<mixed> | PlainObjInput<mixed, mixed>)[]
  857. ): this;
  858. mergeDeepIn(
  859. keyPath: Iterable<mixed>,
  860. ...collections: (Iterable<mixed> | PlainObjInput<mixed, mixed>)[]
  861. ): this;
  862. withMutations(mutator: (mutable: this) => mixed): this;
  863. asMutable(): this;
  864. wasAltered(): boolean;
  865. asImmutable(): this;
  866. // Override specialized return types
  867. flip(): OrderedMap<V, K>;
  868. filter(predicate: typeof Boolean): OrderedMap<K, $NonMaybeType<V>>;
  869. filter(
  870. predicate: (value: V, key: K, iter: this) => mixed,
  871. context?: mixed
  872. ): OrderedMap<K, V>;
  873. map<M>(
  874. mapper: (value: V, key: K, iter: this) => M,
  875. context?: mixed
  876. ): OrderedMap<K, M>;
  877. mapKeys<M>(
  878. mapper: (key: K, value: V, iter: this) => M,
  879. context?: mixed
  880. ): OrderedMap<M, V>;
  881. mapEntries<KM, VM>(
  882. mapper: (entry: [K, V], index: number, iter: this) => [KM, VM],
  883. context?: mixed
  884. ): OrderedMap<KM, VM>;
  885. flatMap<KM, VM>(
  886. mapper: (value: V, key: K, iter: this) => Iterable<[KM, VM]>,
  887. context?: mixed
  888. ): OrderedMap<KM, VM>;
  889. flatten(depth?: number): OrderedMap<any, any>;
  890. flatten(shallow?: boolean): OrderedMap<any, any>;
  891. }
  892. declare function isSet(maybeSet: mixed): boolean %checks(maybeSet instanceof Set);
  893. declare class Set<+T> extends SetCollection<T> {
  894. static <T>(values?: Iterable<T>): Set<T>;
  895. static of<T>(...values: T[]): Set<T>;
  896. static fromKeys<T>(values: Iterable<[T, mixed]> | PlainObjInput<T, mixed>): Set<T>;
  897. static intersect(sets: Iterable<Iterable<T>>): Set<T>;
  898. static union(sets: Iterable<Iterable<T>>): Set<T>;
  899. static isSet: typeof isSet;
  900. size: number;
  901. add<U>(value: U): Set<T | U>;
  902. delete(value: T): this;
  903. remove(value: T): this;
  904. clear(): this;
  905. union<U>(...collections: Iterable<U>[]): Set<T | U>;
  906. merge<U>(...collections: Iterable<U>[]): Set<T | U>;
  907. concat<U>(...collections: Iterable<U>[]): Set<T | U>;
  908. intersect<U>(...collections: Iterable<U>[]): Set<T & U>;
  909. subtract(...collections: Iterable<mixed>[]): this;
  910. withMutations(mutator: (mutable: this) => mixed): this;
  911. asMutable(): this;
  912. wasAltered(): boolean;
  913. asImmutable(): this;
  914. // Override specialized return types
  915. filter(predicate: typeof Boolean): Set<$NonMaybeType<T>>;
  916. filter(
  917. predicate: (value: T, value: T, iter: this) => mixed,
  918. context?: mixed
  919. ): Set<T>;
  920. map<M>(
  921. mapper: (value: T, value: T, iter: this) => M,
  922. context?: mixed
  923. ): Set<M>;
  924. flatMap<M>(
  925. mapper: (value: T, value: T, iter: this) => Iterable<M>,
  926. context?: mixed
  927. ): Set<M>;
  928. flatten(depth?: number): Set<any>;
  929. flatten(shallow?: boolean): Set<any>;
  930. }
  931. // Overrides except for `isOrderedSet` are for specialized return types
  932. declare function isOrderedSet(maybeOrderedSet: mixed): boolean %checks(maybeOrderedSet instanceof OrderedSet);
  933. declare class OrderedSet<+T> extends Set<T> {
  934. static <T>(values?: Iterable<T>): OrderedSet<T>;
  935. static of<T>(...values: T[]): OrderedSet<T>;
  936. static fromKeys<T>(values: Iterable<[T, mixed]> | PlainObjInput<T, mixed>): OrderedSet<T>;
  937. static isOrderedSet: typeof isOrderedSet;
  938. size: number;
  939. add<U>(value: U): OrderedSet<T | U>;
  940. union<U>(...collections: Iterable<U>[]): OrderedSet<T | U>;
  941. merge<U>(...collections: Iterable<U>[]): OrderedSet<T | U>;
  942. concat<U>(...collections: Iterable<U>[]): OrderedSet<T | U>;
  943. intersect<U>(...collections: Iterable<U>[]): OrderedSet<T & U>;
  944. filter(predicate: typeof Boolean): OrderedSet<$NonMaybeType<T>>;
  945. filter(
  946. predicate: (value: T, value: T, iter: this) => mixed,
  947. context?: mixed
  948. ): OrderedSet<T>;
  949. map<M>(
  950. mapper: (value: T, value: T, iter: this) => M,
  951. context?: mixed
  952. ): OrderedSet<M>;
  953. flatMap<M>(
  954. mapper: (value: T, value: T, iter: this) => Iterable<M>,
  955. context?: mixed
  956. ): OrderedSet<M>;
  957. flatten(depth?: number): OrderedSet<any>;
  958. flatten(shallow?: boolean): OrderedSet<any>;
  959. zip<A>(
  960. a: Iterable<A>,
  961. ..._: []
  962. ): OrderedSet<[T, A]>;
  963. zip<A, B>(
  964. a: Iterable<A>,
  965. b: Iterable<B>,
  966. ..._: []
  967. ): OrderedSet<[T, A, B]>;
  968. zip<A, B, C>(
  969. a: Iterable<A>,
  970. b: Iterable<B>,
  971. c: Iterable<C>,
  972. ..._: []
  973. ): OrderedSet<[T, A, B, C]>;
  974. zip<A, B, C, D>(
  975. a: Iterable<A>,
  976. b: Iterable<B>,
  977. c: Iterable<C>,
  978. d: Iterable<D>,
  979. ..._: []
  980. ): OrderedSet<[T, A, B, C, D]>;
  981. zip<A, B, C, D, E>(
  982. a: Iterable<A>,
  983. b: Iterable<B>,
  984. c: Iterable<C>,
  985. d: Iterable<D>,
  986. e: Iterable<E>,
  987. ..._: []
  988. ): OrderedSet<[T, A, B, C, D, E]>;
  989. zipAll<A>(
  990. a: Iterable<A>,
  991. ..._: []
  992. ): OrderedSet<[T|void, A|void]>;
  993. zipAll<A, B>(
  994. a: Iterable<A>,
  995. b: Iterable<B>,
  996. ..._: []
  997. ): OrderedSet<[T|void, A|void, B|void]>;
  998. zipAll<A, B, C>(
  999. a: Iterable<A>,
  1000. b: Iterable<B>,
  1001. c: Iterable<C>,
  1002. ..._: []
  1003. ): OrderedSet<[T|void, A|void, B|void, C|void]>;
  1004. zipAll<A, B, C, D>(
  1005. a: Iterable<A>,
  1006. b: Iterable<B>,
  1007. c: Iterable<C>,
  1008. d: Iterable<D>,
  1009. ..._: []
  1010. ): OrderedSet<[T|void, A|void, B|void, C|void, D|void]>;
  1011. zipAll<A, B, C, D, E>(
  1012. a: Iterable<A>,
  1013. b: Iterable<B>,
  1014. c: Iterable<C>,
  1015. d: Iterable<D>,
  1016. e: Iterable<E>,
  1017. ..._: []
  1018. ): OrderedSet<[T|void, A|void, B|void, C|void, D|void, E|void]>;
  1019. zipWith<A, R>(
  1020. zipper: (value: T, a: A) => R,
  1021. a: Iterable<A>,
  1022. ..._: []
  1023. ): OrderedSet<R>;
  1024. zipWith<A, B, R>(
  1025. zipper: (value: T, a: A, b: B) => R,
  1026. a: Iterable<A>,
  1027. b: Iterable<B>,
  1028. ..._: []
  1029. ): OrderedSet<R>;
  1030. zipWith<A, B, C, R>(
  1031. zipper: (value: T, a: A, b: B, c: C) => R,
  1032. a: Iterable<A>,
  1033. b: Iterable<B>,
  1034. c: Iterable<C>,
  1035. ..._: []
  1036. ): OrderedSet<R>;
  1037. zipWith<A, B, C, D, R>(
  1038. zipper: (value: T, a: A, b: B, c: C, d: D) => R,
  1039. a: Iterable<A>,
  1040. b: Iterable<B>,
  1041. c: Iterable<C>,
  1042. d: Iterable<D>,
  1043. ..._: []
  1044. ): OrderedSet<R>;
  1045. zipWith<A, B, C, D, E, R>(
  1046. zipper: (value: T, a: A, b: B, c: C, d: D, e: E) => R,
  1047. a: Iterable<A>,
  1048. b: Iterable<B>,
  1049. c: Iterable<C>,
  1050. d: Iterable<D>,
  1051. e: Iterable<E>,
  1052. ..._: []
  1053. ): OrderedSet<R>;
  1054. }
  1055. declare function isStack(maybeStack: mixed): boolean %checks(maybeStack instanceof Stack);
  1056. declare class Stack<+T> extends IndexedCollection<T> {
  1057. static <T>(collection?: Iterable<T>): Stack<T>;
  1058. static isStack(maybeStack: mixed): boolean;
  1059. static of<T>(...values: T[]): Stack<T>;
  1060. static isStack: typeof isStack;
  1061. size: number;
  1062. peek(): T;
  1063. clear(): this;
  1064. unshift<U>(...values: U[]): Stack<T | U>;
  1065. unshiftAll<U>(iter: Iterable<U>): Stack<T | U>;
  1066. shift(): this;
  1067. push<U>(...values: U[]): Stack<T | U>;
  1068. pushAll<U>(iter: Iterable<U>): Stack<T | U>;
  1069. pop(): this;
  1070. withMutations(mutator: (mutable: this) => mixed): this;
  1071. asMutable(): this;
  1072. wasAltered(): boolean;
  1073. asImmutable(): this;
  1074. // Override specialized return types
  1075. concat<C>(...iters: Array<Iterable<C> | C>): Stack<T | C>;
  1076. filter(predicate: typeof Boolean): Stack<$NonMaybeType<T>>;
  1077. filter(
  1078. predicate: (value: T, index: number, iter: this) => mixed,
  1079. context?: mixed
  1080. ): Stack<T>;
  1081. map<M>(
  1082. mapper: (value: T, index: number, iter: this) => M,
  1083. context?: mixed
  1084. ): Stack<M>;
  1085. flatMap<M>(
  1086. mapper: (value: T, index: number, iter: this) => Iterable<M>,
  1087. context?: mixed
  1088. ): Stack<M>;
  1089. flatten(depth?: number): Stack<any>;
  1090. flatten(shallow?: boolean): Stack<any>;
  1091. zip<A>(
  1092. a: Iterable<A>,
  1093. ..._: []
  1094. ): Stack<[T, A]>;
  1095. zip<A, B>(
  1096. a: Iterable<A>,
  1097. b: Iterable<B>,
  1098. ..._: []
  1099. ): Stack<[T, A, B]>;
  1100. zip<A, B, C>(
  1101. a: Iterable<A>,
  1102. b: Iterable<B>,
  1103. c: Iterable<C>,
  1104. ..._: []
  1105. ): Stack<[T, A, B, C]>;
  1106. zip<A, B, C, D>(
  1107. a: Iterable<A>,
  1108. b: Iterable<B>,
  1109. c: Iterable<C>,
  1110. d: Iterable<D>,
  1111. ..._: []
  1112. ): Stack<[T, A, B, C, D]>;
  1113. zip<A, B, C, D, E>(
  1114. a: Iterable<A>,
  1115. b: Iterable<B>,
  1116. c: Iterable<C>,
  1117. d: Iterable<D>,
  1118. e: Iterable<E>,
  1119. ..._: []
  1120. ): Stack<[T, A, B, C, D, E]>;
  1121. zipAll<A>(
  1122. a: Iterable<A>,
  1123. ..._: []
  1124. ): Stack<[T|void, A|void]>;
  1125. zipAll<A, B>(
  1126. a: Iterable<A>,
  1127. b: Iterable<B>,
  1128. ..._: []
  1129. ): Stack<[T|void, A|void, B|void]>;
  1130. zipAll<A, B, C>(
  1131. a: Iterable<A>,
  1132. b: Iterable<B>,
  1133. c: Iterable<C>,
  1134. ..._: []
  1135. ): Stack<[T|void, A|void, B|void, C|void]>;
  1136. zipAll<A, B, C, D>(
  1137. a: Iterable<A>,
  1138. b: Iterable<B>,
  1139. c: Iterable<C>,
  1140. d: Iterable<D>,
  1141. ..._: []
  1142. ): Stack<[T|void, A|void, B|void, C|void, D|void]>;
  1143. zipAll<A, B, C, D, E>(
  1144. a: Iterable<A>,
  1145. b: Iterable<B>,
  1146. c: Iterable<C>,
  1147. d: Iterable<D>,
  1148. e: Iterable<E>,
  1149. ..._: []
  1150. ): Stack<[T|void, A|void, B|void, C|void, D|void, E|void]>;
  1151. zipWith<A, R>(
  1152. zipper: (value: T, a: A) => R,
  1153. a: Iterable<A>,
  1154. ..._: []
  1155. ): Stack<R>;
  1156. zipWith<A, B, R>(
  1157. zipper: (value: T, a: A, b: B) => R,
  1158. a: Iterable<A>,
  1159. b: Iterable<B>,
  1160. ..._: []
  1161. ): Stack<R>;
  1162. zipWith<A, B, C, R>(
  1163. zipper: (value: T, a: A, b: B, c: C) => R,
  1164. a: Iterable<A>,
  1165. b: Iterable<B>,
  1166. c: Iterable<C>,
  1167. ..._: []
  1168. ): Stack<R>;
  1169. zipWith<A, B, C, D, R>(
  1170. zipper: (value: T, a: A, b: B, c: C, d: D) => R,
  1171. a: Iterable<A>,
  1172. b: Iterable<B>,
  1173. c: Iterable<C>,
  1174. d: Iterable<D>,
  1175. ..._: []
  1176. ): Stack<R>;
  1177. zipWith<A, B, C, D, E, R>(
  1178. zipper: (value: T, a: A, b: B, c: C, d: D, e: E) => R,
  1179. a: Iterable<A>,
  1180. b: Iterable<B>,
  1181. c: Iterable<C>,
  1182. d: Iterable<D>,
  1183. e: Iterable<E>,
  1184. ..._: []
  1185. ): Stack<R>;
  1186. }
  1187. declare function Range(start?: number, end?: number, step?: number): IndexedSeq<number>;
  1188. declare function Repeat<T>(value: T, times?: number): IndexedSeq<T>;
  1189. // The type of a Record factory function.
  1190. type RecordFactory<Values: Object> = Class<RecordInstance<Values>>;
  1191. // The type of runtime Record instances.
  1192. type RecordOf<Values: Object> = RecordInstance<Values> & $ReadOnly<Values>;
  1193. // The values of a Record instance.
  1194. type _RecordValues<T, R: RecordInstance<T> | T> = R;
  1195. type RecordValues<R> = _RecordValues<*, R>;
  1196. declare function isRecord(maybeRecord: any): boolean %checks(maybeRecord instanceof RecordInstance);
  1197. declare class Record {
  1198. static <Values: Object>(spec: Values, name?: string): typeof RecordInstance;
  1199. constructor<Values: Object>(spec: Values, name?: string): typeof RecordInstance;
  1200. static isRecord: typeof isRecord;
  1201. static getDescriptiveName(record: RecordInstance<any>): string;
  1202. }
  1203. declare class RecordInstance<T: Object = Object> {
  1204. static (values?: Iterable<[$Keys<T>, $ValOf<T>]> | $Shape<T>): RecordOf<T>;
  1205. // Note: a constructor can only create an instance of RecordInstance<T>,
  1206. // it's encouraged to not use `new` when creating Records.
  1207. constructor (values?: Iterable<[$Keys<T>, $ValOf<T>]> | $Shape<T>): void;
  1208. size: number;
  1209. has(key: string): boolean;
  1210. get<K: $Keys<T>>(key: K, ..._: []): $ElementType<T, K>;
  1211. get<K: $Keys<T>, NSV>(key: K, notSetValue: NSV): $ElementType<T, K> | NSV;
  1212. hasIn(keyPath: Iterable<mixed>): boolean;
  1213. getIn(keyPath: [], notSetValue?: mixed): this & $ReadOnly<T>;
  1214. getIn<K: $Keys<T>>(keyPath: [K], notSetValue?: mixed): $ElementType<T, K>;
  1215. getIn<NSV, K: $Keys<T>, K2: $KeyOf<$ValOf<T, K>>>(keyPath: [K, K2], notSetValue: NSV): $ValOf<$ValOf<T, K>, K2> | NSV;
  1216. getIn<NSV, K: $Keys<T>, K2: $KeyOf<$ValOf<T, K>>, K3: $KeyOf<$ValOf<$ValOf<T, K>, K2>>>(keyPath: [K, K2, K3], notSetValue: NSV): $ValOf<$ValOf<$ValOf<T, K>, K2>, K3> | NSV;
  1217. getIn<NSV, K: $Keys<T>, K2: $KeyOf<$ValOf<T, K>>, K3: $KeyOf<$ValOf<$ValOf<T, K>, K2>>, K4: $KeyOf<$ValOf<$ValOf<$ValOf<T, K>, K2>, K3>>>(keyPath: [K, K2, K3, K4], notSetValue: NSV): $ValOf<$ValOf<$ValOf<$ValOf<T, K>, K2>, K3>, K4> | NSV;
  1218. getIn<NSV, K: $Keys<T>, K2: $KeyOf<$ValOf<T, K>>, K3: $KeyOf<$ValOf<$ValOf<T, K>, K2>>, K4: $KeyOf<$ValOf<$ValOf<$ValOf<T, K>, K2>, K3>>, K5: $KeyOf<$ValOf<$ValOf<$ValOf<$ValOf<T, K>, K2>, K3>, K4>>>(keyPath: [K, K2, K3, K4, K5], notSetValue: NSV): $ValOf<$ValOf<$ValOf<$ValOf<$ValOf<T, K>, K2>, K3>, K4>, K5> | NSV;
  1219. equals(other: any): boolean;
  1220. hashCode(): number;
  1221. set<K: $Keys<T>>(key: K, value: $ElementType<T, K>): this & $ReadOnly<T>;
  1222. update<K: $Keys<T>>(key: K, updater: (value: $ElementType<T, K>) => $ElementType<T, K>): this & $ReadOnly<T>;
  1223. merge(...collections: Array<Iterable<[$Keys<T>, $ValOf<T>]> | $Shape<T>>): this & $ReadOnly<T>;
  1224. mergeDeep(...collections: Array<Iterable<[$Keys<T>, $ValOf<T>]> | $Shape<T>>): this & $ReadOnly<T>;
  1225. mergeWith(
  1226. merger: (oldVal: $ValOf<T>, newVal: $ValOf<T>, key: $Keys<T>) => $ValOf<T>,
  1227. ...collections: Array<Iterable<[$Keys<T>, $ValOf<T>]> | $Shape<T>>
  1228. ): this & $ReadOnly<T>;
  1229. mergeDeepWith(
  1230. merger: (oldVal: any, newVal: any, key: any) => any,
  1231. ...collections: Array<Iterable<[$Keys<T>, $ValOf<T>]> | $Shape<T>>
  1232. ): this & $ReadOnly<T>;
  1233. delete<K: $Keys<T>>(key: K): this & $ReadOnly<T>;
  1234. remove<K: $Keys<T>>(key: K): this & $ReadOnly<T>;
  1235. clear(): this & $ReadOnly<T>;
  1236. setIn<S>(keyPath: [], value: S): S;
  1237. setIn<K: $Keys<T>, S: $ValOf<T, K>>(keyPath: [K], value: S): this & $ReadOnly<T>;
  1238. setIn<K: $Keys<T>, K2: $KeyOf<$ValOf<T, K>>, S: $ValOf<$ValOf<T, K>, K2>>(keyPath: [K, K2], value: S): this & $ReadOnly<T>;
  1239. setIn<K: $Keys<T>, K2: $KeyOf<$ValOf<T, K>>, K3: $KeyOf<$ValOf<$ValOf<T, K>, K2>>, S: $ValOf<$ValOf<$ValOf<T, K>, K2>, K3>>(keyPath: [K, K2, K3], value: S): this & $ReadOnly<T>;
  1240. setIn<K: $Keys<T>, K2: $KeyOf<$ValOf<T, K>>, K3: $KeyOf<$ValOf<$ValOf<T, K>, K2>>, K4: $KeyOf<$ValOf<$ValOf<$ValOf<T, K>, K2>, K3>>, S: $ValOf<$ValOf<$ValOf<$ValOf<T, K>, K2>, K3>, K4>>(keyPath: [K, K2, K3, K4], value: S): this & $ReadOnly<T>;
  1241. setIn<K: $Keys<T>, K2: $KeyOf<$ValOf<T, K>>, K3: $KeyOf<$ValOf<$ValOf<T, K>, K2>>, K4: $KeyOf<$ValOf<$ValOf<$ValOf<T, K>, K2>, K3>>, K5: $KeyOf<$ValOf<$ValOf<$ValOf<$ValOf<T, K>, K2>, K3>, K4>>, S: $ValOf<$ValOf<$ValOf<$ValOf<$ValOf<T, K>, K2>, K3>, K4>, K5>>(keyPath: [K, K2, K3, K4, K5], value: S): this & $ReadOnly<T>;
  1242. deleteIn(keyPath: []): void;
  1243. deleteIn<K: $Keys<T>>(keyPath: [K]): this & $ReadOnly<T>;
  1244. deleteIn<K: $Keys<T>, K2: $KeyOf<$ValOf<T, K>>>(keyPath: [K, K2]): this & $ReadOnly<T>;
  1245. deleteIn<K: $Keys<T>, K2: $KeyOf<$ValOf<T, K>>, K3: $KeyOf<$ValOf<$ValOf<T, K>, K2>>>(keyPath: [K, K2, K3]): this & $ReadOnly<T>;
  1246. deleteIn<K: $Keys<T>, K2: $KeyOf<$ValOf<T, K>>, K3: $KeyOf<$ValOf<$ValOf<T, K>, K2>>, K4: $KeyOf<$ValOf<$ValOf<$ValOf<T, K>, K2>, K3>>>(keyPath: [K, K2, K3, K4]): this & $ReadOnly<T>;
  1247. deleteIn<K: $Keys<T>, K2: $KeyOf<$ValOf<T, K>>, K3: $KeyOf<$ValOf<$ValOf<T, K>, K2>>, K4: $KeyOf<$ValOf<$ValOf<$ValOf<T, K>, K2>, K3>>, K5: $KeyOf<$ValOf<$ValOf<$ValOf<$ValOf<T, K>, K2>, K3>, K4>>>(keyPath: [K, K2, K3, K4, K5]): this & $ReadOnly<T>;
  1248. removeIn(keyPath: []): void;
  1249. removeIn<K: $Keys<T>>(keyPath: [K]): this & $ReadOnly<T>;
  1250. removeIn<K: $Keys<T>, K2: $KeyOf<$ValOf<T, K>>>(keyPath: [K, K2]): this & $ReadOnly<T>;
  1251. removeIn<K: $Keys<T>, K2: $KeyOf<$ValOf<T, K>>, K3: $KeyOf<$ValOf<$ValOf<T, K>, K2>>>(keyPath: [K, K2, K3]): this & $ReadOnly<T>;
  1252. removeIn<K: $Keys<T>, K2: $KeyOf<$ValOf<T, K>>, K3: $KeyOf<$ValOf<$ValOf<T, K>, K2>>, K4: $KeyOf<$ValOf<$ValOf<$ValOf<T, K>, K2>, K3>>>(keyPath: [K, K2, K3, K4]): this & $ReadOnly<T>;
  1253. removeIn<K: $Keys<T>, K2: $KeyOf<$ValOf<T, K>>, K3: $KeyOf<$ValOf<$ValOf<T, K>, K2>>, K4: $KeyOf<$ValOf<$ValOf<$ValOf<T, K>, K2>, K3>>, K5: $KeyOf<$ValOf<$ValOf<$ValOf<$ValOf<T, K>, K2>, K3>, K4>>>(keyPath: [K, K2, K3, K4, K5]): this & $ReadOnly<T>;
  1254. updateIn<U>(keyPath: [], notSetValue: mixed, updater: (value: this & T) => U): U;
  1255. updateIn<U>(keyPath: [], updater: (value: this & T) => U): U;
  1256. updateIn<NSV, K: $Keys<T>, S: $ValOf<T, K>>(keyPath: [K], notSetValue: NSV, updater: (value: $ValOf<T, K>) => S): this & $ReadOnly<T>;
  1257. updateIn<K: $Keys<T>, S: $ValOf<T, K>>(keyPath: [K], updater: (value: $ValOf<T, K>) => S): this & $ReadOnly<T>;
  1258. updateIn<NSV, K: $Keys<T>, K2: $KeyOf<$ValOf<T, K>>, S: $ValOf<$ValOf<T, K>, K2>>(keyPath: [K, K2], notSetValue: NSV, updater: (value: $ValOf<$ValOf<T, K>, K2> | NSV) => S): this & $ReadOnly<T>;
  1259. updateIn<K: $Keys<T>, K2: $KeyOf<$ValOf<T, K>>, S: $ValOf<$ValOf<T, K>, K2>>(keyPath: [K, K2], updater: (value: $ValOf<$ValOf<T, K>, K2>) => S): this & $ReadOnly<T>;
  1260. updateIn<NSV, K: $Keys<T>, K2: $KeyOf<$ValOf<T, K>>, K3: $KeyOf<$ValOf<$ValOf<T, K>, K2>>, S: $ValOf<$ValOf<$ValOf<T, K>, K2>, K3>>(keyPath: [K, K2, K3], notSetValue: NSV, updater: (value: $ValOf<$ValOf<$ValOf<T, K>, K2>, K3> | NSV) => S): this & $ReadOnly<T>;
  1261. updateIn<K: $Keys<T>, K2: $KeyOf<$ValOf<T, K>>, K3: $KeyOf<$ValOf<$ValOf<T, K>, K2>>, S: $ValOf<$ValOf<$ValOf<T, K>, K2>, K3>>(keyPath: [K, K2, K3], updater: (value: $ValOf<$ValOf<$ValOf<T, K>, K2>, K3>) => S): this & $ReadOnly<T>;
  1262. updateIn<NSV, K: $Keys<T>, K2: $KeyOf<$ValOf<T, K>>, K3: $KeyOf<$ValOf<$ValOf<T, K>, K2>>, K4: $KeyOf<$ValOf<$ValOf<$ValOf<T, K>, K2>, K3>>, S: $ValOf<$ValOf<$ValOf<$ValOf<T, K>, K2>, K3>, K4>>(keyPath: [K, K2, K3, K4], notSetValue: NSV, updater: (value: $ValOf<$ValOf<$ValOf<$ValOf<T, K>, K2>, K3>, K4> | NSV) => S): this & $ReadOnly<T>;
  1263. updateIn<K: $Keys<T>, K2: $KeyOf<$ValOf<T, K>>, K3: $KeyOf<$ValOf<$ValOf<T, K>, K2>>, K4: $KeyOf<$ValOf<$ValOf<$ValOf<T, K>, K2>, K3>>, S: $ValOf<$ValOf<$ValOf<$ValOf<T, K>, K2>, K3>, K4>>(keyPath: [K, K2, K3, K4], updater: (value: $ValOf<$ValOf<$ValOf<$ValOf<T, K>, K2>, K3>, K4>) => S): this & $ReadOnly<T>;
  1264. updateIn<NSV, K: $Keys<T>, K2: $KeyOf<$ValOf<T, K>>, K3: $KeyOf<$ValOf<$ValOf<T, K>, K2>>, K4: $KeyOf<$ValOf<$ValOf<$ValOf<T, K>, K2>, K3>>, K5: $KeyOf<$ValOf<$ValOf<$ValOf<$ValOf<T, K>, K2>, K3>, K4>>, S: $ValOf<$ValOf<$ValOf<$ValOf<$ValOf<T, K>, K2>, K3>, K4>, K5>>(keyPath: [K, K2, K3, K4, K5], notSetValue: NSV, updater: (value: $ValOf<$ValOf<$ValOf<$ValOf<$ValOf<T, K>, K2>, K3>, K4>, K5> | NSV) => S): this & $ReadOnly<T>;
  1265. updateIn<K: $Keys<T>, K2: $KeyOf<$ValOf<T, K>>, K3: $KeyOf<$ValOf<$ValOf<T, K>, K2>>, K4: $KeyOf<$ValOf<$ValOf<$ValOf<T, K>, K2>, K3>>, K5: $KeyOf<$ValOf<$ValOf<$ValOf<$ValOf<T, K>, K2>, K3>, K4>>, S: $ValOf<$ValOf<$ValOf<$ValOf<$ValOf<T, K>, K2>, K3>, K4>, K5>>(keyPath: [K, K2, K3, K4, K5], updater: (value: $ValOf<$ValOf<$ValOf<$ValOf<$ValOf<T, K>, K2>, K3>, K4>, K5>) => S): this & $ReadOnly<T>;
  1266. mergeIn(keyPath: Iterable<mixed>, ...collections: Array<any>): this & $ReadOnly<T>;
  1267. mergeDeepIn(keyPath: Iterable<mixed>, ...collections: Array<any>): this & $ReadOnly<T>;
  1268. toSeq(): KeyedSeq<$Keys<T>, any>;
  1269. toJS(): { [key: $Keys<T>]: mixed };
  1270. toJSON(): T;
  1271. toObject(): T;
  1272. withMutations(mutator: (mutable: this & T) => mixed): this & $ReadOnly<T>;
  1273. asMutable(): this & $ReadOnly<T>;
  1274. wasAltered(): boolean;
  1275. asImmutable(): this & $ReadOnly<T>;
  1276. @@iterator(): Iterator<[$Keys<T>, $ValOf<T>]>;
  1277. }
  1278. declare function fromJS(
  1279. jsValue: mixed,
  1280. reviver?: (
  1281. key: string | number,
  1282. sequence: KeyedCollection<string, mixed> | IndexedCollection<mixed>,
  1283. path?: Array<string | number>
  1284. ) => mixed
  1285. ): mixed;
  1286. declare function is(first: mixed, second: mixed): boolean;
  1287. declare function hash(value: mixed): number;
  1288. declare function get<C: Object, K: $Keys<C>>(collection: C, key: K, notSetValue: mixed): $ValOf<C, K>;
  1289. declare function get<C, K: $KeyOf<C>, NSV>(collection: C, key: K, notSetValue: NSV): $ValOf<C, K> | NSV;
  1290. declare function has(collection: Object, key: mixed): boolean;
  1291. declare function remove<C>(collection: C, key: $KeyOf<C>): C;
  1292. declare function set<C, K: $KeyOf<C>, V: $ValOf<C, K>>(collection: C, key: K, value: V): C;
  1293. declare function update<C, K: $KeyOf<C>, V: $ValOf<C, K>, NSV>(collection: C, key: K, notSetValue: NSV, updater: ($ValOf<C, K> | NSV) => V): C;
  1294. declare function update<C, K: $KeyOf<C>, V: $ValOf<C, K>>(collection: C, key: K, updater: ($ValOf<C, K>) => V): C;
  1295. declare function getIn<C>(collection: C, keyPath: [], notSetValue?: mixed): C;
  1296. declare function getIn<C, K: $KeyOf<C>, NSV>(collection: C, keyPath: [K], notSetValue: NSV): $ValOf<C, K> | NSV;
  1297. declare function getIn<C, K: $KeyOf<C>, K2: $KeyOf<$ValOf<C, K>>, NSV>(collection: C, keyPath: [K, K2], notSetValue: NSV): $ValOf<$ValOf<C, K>, K2> | NSV;
  1298. declare function getIn<C, K: $KeyOf<C>, K2: $KeyOf<$ValOf<C, K>>, K3: $KeyOf<$ValOf<$ValOf<C, K>, K2>>, NSV>(collection: C, keyPath: [K, K2, K3], notSetValue: NSV): $ValOf<$ValOf<$ValOf<C, K>, K2>, K3> | NSV;
  1299. declare function getIn<C, K: $KeyOf<C>, K2: $KeyOf<$ValOf<C, K>>, K3: $KeyOf<$ValOf<$ValOf<C, K>, K2>>, K4: $KeyOf<$ValOf<$ValOf<$ValOf<C, K>, K2>, K3>>, NSV>(collection: C, keyPath: [K, K2, K3, K4], notSetValue: NSV): $ValOf<$ValOf<$ValOf<$ValOf<C, K>, K2>, K3>, K4> | NSV;
  1300. declare function getIn<C, K: $KeyOf<C>, K2: $KeyOf<$ValOf<C, K>>, K3: $KeyOf<$ValOf<$ValOf<C, K>, K2>>, K4: $KeyOf<$ValOf<$ValOf<$ValOf<C, K>, K2>, K3>>, K5: $KeyOf<$ValOf<$ValOf<$ValOf<$ValOf<C, K>, K2>, K3>, K4>>, NSV>(collection: C, keyPath: [K, K2, K3, K4, K5], notSetValue: NSV): $ValOf<$ValOf<$ValOf<$ValOf<$ValOf<C, K>, K2>, K3>, K4>, K5> | NSV;
  1301. declare function hasIn(collection: Object, keyPath: Iterable<mixed>): boolean;
  1302. declare function removeIn<C>(collection: C, keyPath: []): void;
  1303. declare function removeIn<C, K: $KeyOf<C>>(collection: C, keyPath: [K]): C;
  1304. declare function removeIn<C, K: $KeyOf<C>, K2: $KeyOf<$ValOf<C>>>(collection: C, keyPath: [K, K2]): C;
  1305. declare function removeIn<C, K: $KeyOf<C>, K2: $KeyOf<$ValOf<C>>, K3: $KeyOf<$ValOf<$ValOf<C>, K2>>>(collection: C, keyPath: [K, K2, K3]): C;
  1306. declare function removeIn<C, K: $KeyOf<C>, K2: $KeyOf<$ValOf<C>>, K3: $KeyOf<$ValOf<$ValOf<C>, K2>>, K4: $KeyOf<$ValOf<$ValOf<$ValOf<C>, K2>, K3>>>(collection: C, keyPath: [K, K2, K3, K4]): C;
  1307. declare function removeIn<C, K: $KeyOf<C>, K2: $KeyOf<$ValOf<C>>, K3: $KeyOf<$ValOf<$ValOf<C>, K2>>, K4: $KeyOf<$ValOf<$ValOf<$ValOf<C>, K2>, K3>>, K5: $KeyOf<$ValOf<$ValOf<$ValOf<$ValOf<C>, K2>, K3>, K4>>>(collection: C, keyPath: [K, K2, K3, K4, K5]): C;
  1308. declare function setIn<S>(collection: Object, keyPath: [], value: S): S;
  1309. declare function setIn<C, K: $KeyOf<C>, S: $ValOf<C, K>>(collection: C, keyPath: [K], value: S): C;
  1310. declare function setIn<C, K: $KeyOf<C>, K2: $KeyOf<$ValOf<C, K>>, S: $ValOf<$ValOf<C, K>, K2>>(collection: C, keyPath: [K, K2], value: S): C;
  1311. declare function setIn<C, K: $KeyOf<C>, K2: $KeyOf<$ValOf<C, K>>, K3: $KeyOf<$ValOf<$ValOf<C, K>, K2>>, S: $ValOf<$ValOf<$ValOf<C, K>, K2>, K3>>(collection: C, keyPath: [K, K2, K3], value: S): C;
  1312. declare function setIn<C, K: $KeyOf<C>, K2: $KeyOf<$ValOf<C, K>>, K3: $KeyOf<$ValOf<$ValOf<C, K>, K2>>, K4: $KeyOf<$ValOf<$ValOf<$ValOf<C, K>, K2>, K3>>, S: $ValOf<$ValOf<$ValOf<$ValOf<C, K>, K2>, K3>, K4>>(collection: C, keyPath: [K, K2, K3, K4], value: S): C;
  1313. declare function setIn<C, K: $KeyOf<C>, K2: $KeyOf<$ValOf<C, K>>, K3: $KeyOf<$ValOf<$ValOf<C, K>, K2>>, K4: $KeyOf<$ValOf<$ValOf<$ValOf<C, K>, K2>, K3>>, K5: $KeyOf<$ValOf<$ValOf<$ValOf<$ValOf<C, K>, K2>, K3>, K4>>, S: $ValOf<$ValOf<$ValOf<$ValOf<$ValOf<C, K>, K2>, K3>, K4>, K5>>(collection: C, keyPath: [K, K2, K3, K4, K5], value: S): C;
  1314. declare function updateIn<C, S>(collection: C, keyPath: [], notSetValue: mixed, updater: (value: C) => S): S;
  1315. declare function updateIn<C, S>(collection: C, keyPath: [], updater: (value: C) => S): S;
  1316. declare function updateIn<C, K: $KeyOf<C>, S: $ValOf<C, K>, NSV>(collection: C, keyPath: [K], notSetValue: NSV, updater: (value: $ValOf<C, K> | NSV) => S): C;
  1317. declare function updateIn<C, K: $KeyOf<C>, S: $ValOf<C, K>>(collection: C, keyPath: [K], updater: (value: $ValOf<C, K>) => S): C;
  1318. declare function updateIn<C, K: $KeyOf<C>, K2: $KeyOf<$ValOf<C, K>>, S: $ValOf<$ValOf<C, K>, K2>, NSV>(collection: C, keyPath: [K, K2], notSetValue: NSV, updater: (value: $ValOf<$ValOf<C, K>, K2> | NSV) => S): C;
  1319. declare function updateIn<C, K: $KeyOf<C>, K2: $KeyOf<$ValOf<C, K>>, S: $ValOf<$ValOf<C, K>, K2>>(collection: C, keyPath: [K, K2], updater: (value: $ValOf<$ValOf<C, K>, K2>) => S): C;
  1320. declare function updateIn<C, K: $KeyOf<C>, K2: $KeyOf<$ValOf<C, K>>, K3: $KeyOf<$ValOf<$ValOf<C, K>, K2>>, S: $ValOf<$ValOf<$ValOf<C, K>, K2>, K3>, NSV>(collection: C, keyPath: [K, K2, K3], notSetValue: NSV, updater: (value: $ValOf<$ValOf<$ValOf<C, K>, K2>, K3> | NSV) => S): C;
  1321. declare function updateIn<C, K: $KeyOf<C>, K2: $KeyOf<$ValOf<C, K>>, K3: $KeyOf<$ValOf<$ValOf<C, K>, K2>>, S: $ValOf<$ValOf<$ValOf<C, K>, K2>, K3>>(collection: C, keyPath: [K, K2, K3], updater: (value: $ValOf<$ValOf<$ValOf<C, K>, K2>, K3>) => S): C;
  1322. declare function updateIn<C, K: $KeyOf<C>, K2: $KeyOf<$ValOf<C, K>>, K3: $KeyOf<$ValOf<$ValOf<C, K>, K2>>, K4: $KeyOf<$ValOf<$ValOf<$ValOf<C, K>, K2>, K3>>, S: $ValOf<$ValOf<$ValOf<$ValOf<C, K>, K2>, K3>, K4>, NSV>(collection: C, keyPath: [K, K2, K3, K4], notSetValue: NSV, updater: (value: $ValOf<$ValOf<$ValOf<$ValOf<C, K>, K2>, K3>, K4> | NSV) => S): C;
  1323. declare function updateIn<C, K: $KeyOf<C>, K2: $KeyOf<$ValOf<C, K>>, K3: $KeyOf<$ValOf<$ValOf<C, K>, K2>>, K4: $KeyOf<$ValOf<$ValOf<$ValOf<C, K>, K2>, K3>>, S: $ValOf<$ValOf<$ValOf<$ValOf<C, K>, K2>, K3>, K4>>(collection: C, keyPath: [K, K2, K3, K4], updater: (value: $ValOf<$ValOf<$ValOf<$ValOf<C, K>, K2>, K3>, K4>) => S): C;
  1324. declare function updateIn<C, K: $KeyOf<C>, K2: $KeyOf<$ValOf<C, K>>, K3: $KeyOf<$ValOf<$ValOf<C, K>, K2>>, K4: $KeyOf<$ValOf<$ValOf<$ValOf<C, K>, K2>, K3>>, K5: $KeyOf<$ValOf<$ValOf<$ValOf<$ValOf<C, K>, K2>, K3>, K4>>, S: $ValOf<$ValOf<$ValOf<$ValOf<$ValOf<C, K>, K2>, K3>, K4>, K5>, NSV>(collection: C, keyPath: [K, K2, K3, K4, K5], notSetValue: NSV, updater: (value: $ValOf<$ValOf<$ValOf<$ValOf<$ValOf<C, K>, K2>, K3>, K4>, K5> | NSV) => S): C;
  1325. declare function updateIn<C, K: $KeyOf<C>, K2: $KeyOf<$ValOf<C, K>>, K3: $KeyOf<$ValOf<$ValOf<C, K>, K2>>, K4: $KeyOf<$ValOf<$ValOf<$ValOf<C, K>, K2>, K3>>, K5: $KeyOf<$ValOf<$ValOf<$ValOf<$ValOf<C, K>, K2>, K3>, K4>>, S: $ValOf<$ValOf<$ValOf<$ValOf<$ValOf<C, K>, K2>, K3>, K4>, K5>>(collection: C, keyPath: [K, K2, K3, K4, K5], updater: (value: $ValOf<$ValOf<$ValOf<$ValOf<$ValOf<C, K>, K2>, K3>, K4>, K5>) => S): C;
  1326. declare function merge<C>(
  1327. collection: C,
  1328. ...collections: Array<$IterableOf<C> | $Shape<RecordValues<C>> | PlainObjInput<$KeyOf<C>, $ValOf<C>>>
  1329. ): C;
  1330. declare function mergeWith<C>(
  1331. merger: (oldVal: $ValOf<C>, newVal: $ValOf<C>, key: $KeyOf<C>) => $ValOf<C>,
  1332. collection: C,
  1333. ...collections: Array<$IterableOf<C> | $Shape<RecordValues<C>> | PlainObjInput<$KeyOf<C>, $ValOf<C>>>
  1334. ): C;
  1335. declare function mergeDeep<C>(
  1336. collection: C,
  1337. ...collections: Array<$IterableOf<C> | $Shape<RecordValues<C>> | PlainObjInput<$KeyOf<C>, $ValOf<C>>>
  1338. ): C;
  1339. declare function mergeDeepWith<C>(
  1340. merger: (oldVal: any, newVal: any, key: any) => mixed,
  1341. collection: C,
  1342. ...collections: Array<$IterableOf<C> | $Shape<RecordValues<C>> | PlainObjInput<$KeyOf<C>, $ValOf<C>>>
  1343. ): C;
  1344. export {
  1345. Collection,
  1346. Seq,
  1347. List,
  1348. Map,
  1349. OrderedMap,
  1350. OrderedSet,
  1351. Range,
  1352. Repeat,
  1353. Record,
  1354. Set,
  1355. Stack,
  1356. fromJS,
  1357. is,
  1358. hash,
  1359. isImmutable,
  1360. isCollection,
  1361. isKeyed,
  1362. isIndexed,
  1363. isAssociative,
  1364. isOrdered,
  1365. isRecord,
  1366. isValueObject,
  1367. get,
  1368. has,
  1369. remove,
  1370. set,
  1371. update,
  1372. getIn,
  1373. hasIn,
  1374. removeIn,
  1375. setIn,
  1376. updateIn,
  1377. merge,
  1378. mergeWith,
  1379. mergeDeep,
  1380. mergeDeepWith,
  1381. }
  1382. export default {
  1383. Collection,
  1384. Seq,
  1385. List,
  1386. Map,
  1387. OrderedMap,
  1388. OrderedSet,
  1389. Range,
  1390. Repeat,
  1391. Record,
  1392. Set,
  1393. Stack,
  1394. fromJS,
  1395. is,
  1396. hash,
  1397. isImmutable,
  1398. isCollection,
  1399. isKeyed,
  1400. isIndexed,
  1401. isAssociative,
  1402. isOrdered,
  1403. isRecord,
  1404. isValueObject,
  1405. get,
  1406. has,
  1407. remove,
  1408. set,
  1409. update,
  1410. getIn,
  1411. hasIn,
  1412. removeIn,
  1413. setIn,
  1414. updateIn,
  1415. merge,
  1416. mergeWith,
  1417. mergeDeep,
  1418. mergeDeepWith,
  1419. }
  1420. export type {
  1421. KeyedCollection,
  1422. IndexedCollection,
  1423. SetCollection,
  1424. KeyedSeq,
  1425. IndexedSeq,
  1426. SetSeq,
  1427. RecordFactory,
  1428. RecordOf,
  1429. RecordInstance,
  1430. ValueObject,
  1431. $KeyOf,
  1432. $ValOf,
  1433. }