8000 KeyedSeq -> Seq.Keyed · sjfloat/immutable-js@9a3f421 · GitHub
[go: up one dir, main page]

Skip to content

Commit 9a3f421

Browse files
KeyedSeq -> Seq.Keyed
1 parent b9dcfa2 commit 9a3f421

File tree

1 file changed

+39
-38
lines changed

1 file changed

+39
-38
lines changed

type-definitions/Immutable.d.ts

Lines changed: 39 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -1192,6 +1192,33 @@ declare module Immutable {
11921192
*/
11931193
function of<T>(...values: T[]): Seq.Indexed<T>;
11941194

1195+
1196+
/**
1197+
* `Seq` which represents key-value pairs.
1198+
*/
1199+
export module Keyed {}
1200+
1201+
/**
1202+
* Always returns a Seq.Keyed, if input is not keyed, expects an
1203+
* iterable of [K, V] tuples.
1204+
*/
1205+
export function Keyed<K, V>(): Seq.Keyed<K, V>;
1206+
export function Keyed<K, V>(seq: KeyedIterable<K, V>): Seq.Keyed<K, V>;
1207+
export function Keyed<K, V>(seq: Iterable<any, /*[K,V]*/any>): Seq.Keyed<K, V>;
1208+
export function Keyed<K, V>(array: Array</*[K,V]*/any>): Seq.Keyed<K, V>;
1209+
export function Keyed<V>(obj: {[key: string]: V}): Seq.Keyed<string, V>;
1210+
export function Keyed<K, V>(iterator: Iterator</*[K,V]*/any>): Seq.Keyed<K, V>;
1211+
export function Keyed<K, V>(iterable: /*Iterable<[K,V]>*/Object): Seq.Keyed<K, V>;
1212+
1213+
export interface Keyed<K, V> extends Seq<K, V>, KeyedIterable<K, V> {
1214+
1215+
/**
1216+
* Returns itself
1217+
*/
1218+
toSeq(): /*this*/Seq.Keyed<K, V>
1219+
}
1220+
1221+
11951222
/**
11961223
* `Seq` which represents an ordered indexed list of values.
11971224
*/
@@ -1269,14 +1296,14 @@ declare module Immutable {
12691296
* * If an Array-like, an `Seq.Indexed`.
12701297
* * If an Object with an Iterator, an `Seq.Indexed`.
12711298
* * If an Iterator, an `Seq.Indexed`.
1272-
* * If an Object, a `KeyedSeq`.
1299+
* * If an Object, a `Seq.Keyed`.
12731300
*
12741301
*/
12751302
export function Seq<K, V>(): Seq<K, V>;
12761303
export function Seq<K, V>(seq: Seq<K, V>): Seq<K, V>;
12771304
export function Seq<K, V>(iterable: Iterable<K, V>): Seq<K, V>;
12781305
export function Seq<T>(array: Array<T>): Seq.Indexed<T>;
1279-
export function Seq<V>(obj: {[key: string]: V}): KeyedSeq<string, V>;
1306+
export function Seq<V>(obj: {[key: string]: V}): Seq.Keyed<string, V>;
12801307
export function Seq<T>(iterator: Iterator<T>): Seq.Indexed<T>;
12811308
export function Seq<T>(iterable: /*ES6Iterable<T>*/Object): Seq.Indexed<T>;
12821309

@@ -1320,32 +1347,6 @@ declare module Immutable {
13201347
cacheResult(): /*this*/Seq<K, V>;
13211348
}
13221349

1323-
1324-
/**
1325-
* `Seq` which represents key-value pairs.
1326-
*/
1327-
export module KeyedSeq {}
1328-
1329-
/**
1330-
* Always returns a KeyedSeq, if input is not keyed, expects an
1331-
* iterable of [K, V] tuples.
1332-
*/
1333-
export function KeyedSeq<K, V>(): KeyedSeq<K, V>;
1334-
export function KeyedSeq<K, V>(seq: KeyedIterable<K, V>): KeyedSeq<K, V>;
1335-
export function KeyedSeq<K, V>(seq: Iterable<any, /*[K,V]*/any>): KeyedSeq<K, V>;
1336-
export function KeyedSeq<K, V>(array: Array</*[K,V]*/any>): KeyedSeq<K, V>;
1337-
export function KeyedSeq<V>(obj: {[key: string]: V}): KeyedSeq<string, V>;
1338-
export function KeyedSeq<K, V>(iterator: Iterator</*[K,V]*/any>): KeyedSeq<K, V>;
1339-
export function KeyedSeq<K, V>(iterable: /*Iterable<[K,V]>*/Object): KeyedSeq<K, V>;
1340-
1341-
export interface KeyedSeq<K, V> extends Seq<K, V>, KeyedIterable<K, V> {
1342-
1343-
/**
1344-
* Returns itself
1345-
*/
1346-
toSeq(): /*this*/KeyedSeq<K, V>
1347-
}
1348-
13491350
/**
13501351
* The `Iterable` is a set of (key, value) entries which can be iterated, and
13511352
* is the base class for all collections in `immutable`, allowing them to
@@ -1579,7 +1580,7 @@ declare module Immutable {
15791580
toSeq(): Seq<K, V>;
15801581

15811582
/**
1582-
* Returns a KeyedSeq from this Iterable where indices are treated as keys.
1583+
* Returns a Seq.Keyed from this Iterable where indices are treated as keys.
15831584
*
15841585
* This is useful if you want to operate on an
15851586
* IndexedIterable and preserve the [index, value] pairs.
@@ -1595,7 +1596,7 @@ declare module Immutable {
15951596
* keyedSeq.filter(v => v === 'B').toString() // Seq { 1: 'B' }
15961597
*
15971598
*/
1598-
toKeyedSeq(): KeyedSeq<K, V>;
1599+
toKeyedSeq(): Seq.Keyed<K, V>;
15991600

16001601
/**
16011602
* Returns an Seq.Indexed of the values of this Iterable, discarding keys.
@@ -1731,7 +1732,7 @@ declare module Immutable {
17311732
groupBy<G>(
17321733
grouper: (value?: V, key?: K, iter?: /*this*/Iterable<K, V>) => G,
17331734
context?: any
1734-
): /*Map*/KeyedSeq<G, /*this*/Iterable<K, V>>;
1735+
): /*Map*/Seq.Keyed<G, /*this*/Iterable<K, V>>;
17351736

17361737

17371738
// Side effects
@@ -1979,7 +1980,7 @@ declare module Immutable {
19791980
): number;
19801981

19811982
/**
1982-
* Returns a `KeyedSeq` of counts, grouped by the return value of
1983+
* Returns a `Seq.Keyed` of counts, grouped by the return value of
19831984
* the `grouper` function.
19841985
*
19851986
* Note: This is not a lazy operation.
@@ -2144,10 +2145,10 @@ declare module Immutable {
21442145
export interface KeyedIterable<K, V> extends Iterable<K, V> {
21452146

21462147
/**
2147-
* Returns KeyedSeq.
2148+
* Returns Seq.Keyed.
21482149
* @override
21492150
*/
2150-
toSeq(): KeyedSeq<K, V>;
2151+
toSeq(): Seq.Keyed<K, V>;
21512152

21522153

21532154
// Sequence functions
@@ -2277,9 +2278,9 @@ declare module Immutable {
22772278

22782279
/**
22792280
* If this is an iterable of [key, value] entry tuples, it will return a
2280-
* KeyedSeq of those entries.
2281+
* Seq.Keyed of those entries.
22812282
*/
2282-
fromEntrySeq(): KeyedSeq<any, any>;
2283+
fromEntrySeq(): Seq.Keyed<any, any>;
22832284

22842285

22852286
// Combination
@@ -2459,10 +2460,10 @@ declare module Immutable {
24592460
export interface KeyedCollection<K, V> extends Collection<K, V>, KeyedIterable<K, V> {
24602461

24612462
/**
2462-
* Returns KeyedSeq.
2463+
* Returns Seq.Keyed.
24632464
* @override
24642465
*/
2465-
toSeq(): KeyedSeq<K, V>;
2466+
toSeq(): Seq.Keyed<K, V>;
24662467
}
24672468

24682469

0 commit comments

Comments
 (0)
0