Skip to content

Commit

Permalink
TS: improve types mapAsyncIterator-test (#3038)
Browse files Browse the repository at this point in the history
  • Loading branch information
saihaj committed Apr 12, 2021
1 parent f103924 commit 33e3a33
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions src/subscription/__tests__/mapAsyncIterator-test.js
Expand Up @@ -25,15 +25,17 @@ describe('mapAsyncIterator', () => {
it('maps over async iterator', async () => {
const items = [1, 2, 3];

const iterator: any = {
const iterator: $FlowFixMe = {
[Symbol.asyncIterator]() {
return this;
},
next() {
return Promise.resolve({
done: items.length === 0,
value: items.shift(),
});

next(): Promise<IteratorResult<number, void>> {
if (items.length > 0) {
return Promise.resolve({ done: false, value: items.shift() });
}

return Promise.resolve({ done: true, value: undefined });
},
};

Expand Down

0 comments on commit 33e3a33

Please sign in to comment.