29
29
*/
30
30
type ESIterable<T> = $Iterable<T,void,void>;
31
31
32
- declare class Iterable<K,V> {
32
+ declare class Iterable<K, V> extends _Iterable<K, V, KeyedIterable, IndexedIterable, SetIterable> {}
33
+
34
+ declare class _Iterable<K,V, KI: KeyedIterable, II: IndexedIterable, SI: SetIterable> {
33
35
static Keyed: typeof KeyedIterable;
34
36
static Indexed: typeof IndexedIterable;
35
37
static Set: typeof SetIterable;
@@ -341,11 +343,7 @@ declare class SetIterable<T> extends Iterable<T,T> {
341
343
): /*this*/SetIterable<U>;
342
344
}
343
345
344
- declare class Collection<K,V> extends Iterable<K,V> {
345
- static Keyed: typeof KeyedCollection;
346
- static Indexed: typeof IndexedCollection;
347
- static Set: typeof SetCollection;
348
-
346
+ declare class Collection<K,V> extends _Iterable<K,V, KeyedCollection, IndexedCollection, SetCollection> {
349
347
size: number;
350
348
}
351
349
@@ -361,11 +359,7 @@ declare class SetCollection<T> extends Collection<T,T> mixins SetIterable<T> {
361
359
toSeq(): SetSeq<T>;
362
360
}
363
361
364
- declare class Seq<K,V> extends Iterable<K,V> {
365
- static Keyed: typeof KeyedSeq;
366
- static Indexed: typeof IndexedSeq;
367
- static Set: typeof SetSeq;
368
-
362
+ declare class Seq<K,V> extends _Iterable<K,V, KeyedSeq, IndexedSeq, SetSeq> {
369
363
static <K,V>(iter: KeyedSeq<K,V>): KeyedSeq<K,V>;
370
364
static <T> (iter: SetSeq<T>): SetSeq<K,V>;
371
365
static <T> (iter?: ESIterable<T>): IndexedSeq<T>;
@@ -602,11 +596,13 @@ declare class Stack<T> extends IndexedCollection<T> {
602
596
declare function Range(start?: number, end?: number, step?: number): IndexedSeq<number>;
603
597
declare function Repeat<T>(value: T, times?: number): IndexedSeq<T>;
604
598
605
- declare class Record<T:Object> {
606
- static <T:Object>(spec: T, name?: string): (values: $Shape<T>) => (T & Record<T>);
599
+ //TODO: Once flow can extend normal Objects we can change this back to actually reflect Record behavior.
600
+ // For now fallback to any to not break existing Code
601
+ declare class Record<T: Object> {
602
+ static <T: Object>(spec: T, name?: string): /*T & Record<T>*/any;
607
603
get<A>(key: $Keys<T>): A;
608
- set<A>(key: $Keys<T>, value: A): T & Record<T>;
609
- remove(key: $Keys<T>): T & Record<T>;
604
+ set<A>(key: $Keys<T>, value: A): /* T & Record<T>*/this ;
605
+ remove(key: $Keys<T>): /* T & Record<T>*/this ;
610
606
}
611
607
612
608
declare function fromJS(json: Object, reviver?: (k: any, v: Iterable<any,any>) => any): any;
0 commit comments