Skip to content

Commit

Permalink
Replaced use of Flows private $Iterable with own Iterable definition
Browse files Browse the repository at this point in the history
Fixes many errors in flow tests.
  • Loading branch information
wokalski committed May 18, 2016
1 parent d7ee48c commit f31e5c2
Showing 1 changed file with 22 additions and 1 deletion.
23 changes: 22 additions & 1 deletion type-definitions/immutable.js.flow
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,28 @@
*
* Note that Immutable values implement the `ESIterable` interface.
*/
type ESIterable<T> = $Iterable<T,void,void>;

type IteratorResult<Yield,Return> = {
done: true,
value?: Return,
} | {
done: false,
value: Yield,
};


interface _Iterator<Yield,Return,Next> {
@@iterator(): _Iterator<Yield,Return,Next>;
next(value?: Next): IteratorResult<Yield,Return>;
}


interface _ESIterable<Yield,Return,Next> {
@@iterator(): _Iterator<Yield,Return,Next>;
}

type Iterator<T> = _Iterator<T, void, void>
type ESIterable<T> = _ESIterable<T,void,void>;

declare class Iterable<K, V> extends _Iterable<K, V, typeof KeyedIterable, typeof IndexedIterable, typeof SetIterable> {}

Expand Down

0 comments on commit f31e5c2

Please sign in to comment.