8000 Replaced use of Flows private $Iterable with own Iterable definition · immutable-js/immutable-js@78811b4 · GitHub
[go: up one dir, main page]

Skip to content

Commit 78811b4

Browse files
committed
Replaced use of Flows private $Iterable with own Iterable definition
Fixes many errors in flow tests.
1 parent ebbf17c commit 78811b4

File tree

1 file changed

+22
-1
lines changed

1 file changed

+22
-1
lines changed

type-definitions/immutable.js.flow

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,28 @@
2727
*
2828
* Note that Immutable values implement the `ESIterable` interface.
2929
*/
30-
type ESIterable<T> = $Iterable<T,void,void>;
30+
31+
type IteratorResult<Yield,Return> = {
32+
done: true,
33+
value?: Return,
34+
} | {
35+
done: false,
36+
value: Yield,
37+
};
38+
39+
40+
interface _Iterator<Yield,Return,Next> {
41+
@@iterator(): _Iterator<Yield,Return,Next>;
42+
next(value?: Next): IteratorResult<Yield,Return>;
43+
}
44+
45+
46+
interface _ESIterable<Yield,Return,Next> {
47+
@@iterator(): _Iterator<Yield,Return,Next>;
48+
}
49+
50+
type Iterator<T> = _Iterator<T, void, void>
51+
type ESIterable<T> = _ESIterable<T,void,void>;
3152

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

0 commit comments

Comments
 (0)
0