immutable.js.flow 61 KB

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