@@ -8,9 +8,8 @@ export function mapAsyncIterator<T, U>(
88 iterable : AsyncIterable < T > | AsyncGenerator < T , void , void > ,
99 callback : ( T ) => PromiseOrValue < U > ,
1010) : AsyncGenerator < U , void , void > {
11- // $FlowFixMe[prop-missing]
12- const iteratorMethod = iterable [ Symbol . asyncIterator ] ;
13- const iterator : any = iteratorMethod . call ( iterable ) ;
11+ // $FlowIssue[incompatible-use]
12+ const iterator = iterable [ Symbol . asyncIterator ] ( ) ;
1413
1514 async function abruptClose ( error : mixed ) {
1615 if ( typeof iterator . return === 'function' ) {
@@ -37,13 +36,11 @@ export function mapAsyncIterator<T, U>(
3736 }
3837 }
3938
40- /* TODO: Flow doesn't support symbols as keys:
41- https://github.com/facebook/flow/issues/3258 */
42- return ( {
39+ return {
4340 next ( ) : Promise < IteratorResult < U , void > > {
4441 return mapResult ( iterator . next( ) ) ;
4542 } ,
46- return ( ) {
43+ return ( ) : Promise < IteratorResult < U , void >> {
4744 return typeof iterator. return === 'function'
4845 ? mapResult ( iterator . return ( ) )
4946 : Promise . resolve ( { value : undefined , done : true } ) ;
@@ -57,5 +54,5 @@ export function mapAsyncIterator<T, U>(
5754 [ Symbol . asyncIterator ] ( ) {
5855 return this ;
5956 } ,
60- } : $FlowFixMe ) ;
57+ } ;
6158}
0 commit comments