immutable.js.flow 61 KB

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