Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit c28c8ae

Browse filesBrowse files
committed
Relax Record class for now
1 parent aa85552 commit c28c8ae
Copy full SHA for c28c8ae

File tree

Expand file treeCollapse file tree

1 file changed

+11
-15
lines changed
Filter options
Expand file treeCollapse file tree

1 file changed

+11
-15
lines changed

‎type-definitions/immutable.js.flow

Copy file name to clipboardExpand all lines: type-definitions/immutable.js.flow
+11-15Lines changed: 11 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,9 @@
2929
*/
3030
type ESIterable<T> = $Iterable<T,void,void>;
3131

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> {
3335
static Keyed: typeof KeyedIterable;
3436
static Indexed: typeof IndexedIterable;
3537
static Set: typeof SetIterable;
@@ -341,11 +343,7 @@ declare class SetIterable<T> extends Iterable<T,T> {
341343
): /*this*/SetIterable<U>;
342344
}
343345

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> {
349347
size: number;
350348
}
351349

@@ -361,11 +359,7 @@ declare class SetCollection<T> extends Collection<T,T> mixins SetIterable<T> {
361359
toSeq(): SetSeq<T>;
362360
}
363361

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> {
369363
static <K,V>(iter: KeyedSeq<K,V>): KeyedSeq<K,V>;
370364
static <T> (iter: SetSeq<T>): SetSeq<K,V>;
371365
static <T> (iter?: ESIterable<T>): IndexedSeq<T>;
@@ -602,11 +596,13 @@ declare class Stack<T> extends IndexedCollection<T> {
602596
declare function Range(start?: number, end?: number, step?: number): IndexedSeq<number>;
603597
declare function Repeat<T>(value: T, times?: number): IndexedSeq<T>;
604598

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;
607603
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;
610606
}
611607

612608
declare function fromJS(json: Object, reviver?: (k: any, v: Iterable<any,any>) => any): any;

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.