Skip to content

Commit 33e3a33

Browse files
authored
TS: improve types mapAsyncIterator-test (#3038)
1 parent f103924 commit 33e3a33

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

src/subscription/__tests__/mapAsyncIterator-test.js

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -25,15 +25,17 @@ describe('mapAsyncIterator', () => {
2525
it('maps over async iterator', async () => {
2626
const items = [1, 2, 3];
2727

28-
const iterator: any = {
28+
const iterator: $FlowFixMe = {
2929
[Symbol.asyncIterator]() {
3030
return this;
3131
},
32-
next() {
33-
return Promise.resolve({
34-
done: items.length === 0,
35-
value: items.shift(),
36-
});
32+
33+
next(): Promise<IteratorResult<number, void>> {
34+
if (items.length > 0) {
35+
return Promise.resolve({ done: false, value: items.shift() });
36+
}
37+
38+
return Promise.resolve({ done: true, value: undefined });
3739
},
3840
};
3941

0 commit comments

Comments
 (0)