@@ -8,9 +8,8 @@ export function mapAsyncIterator<T, U>(
8
8
iterable : AsyncIterable < T > | AsyncGenerator < T , void , void > ,
9
9
callback : ( T ) => PromiseOrValue < U > ,
10
10
) : 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 ] ( ) ;
14
13
15
14
async function abruptClose ( error : mixed ) {
16
15
if ( typeof iterator . return === 'function' ) {
@@ -37,13 +36,11 @@ export function mapAsyncIterator<T, U>(
37
36
}
38
37
}
39
38
40
- /* TODO: Flow doesn't support symbols as keys:
41
- https://github.com/facebook/flow/issues/3258 */
42
- return ( {
39
+ return {
43
40
next ( ) : Promise < IteratorResult < U , void > > {
44
41
return mapResult ( iterator . next( ) ) ;
45
42
} ,
46
- return ( ) {
43
+ return ( ) : Promise < IteratorResult < U , void >> {
47
44
return typeof iterator. return === 'function'
48
45
? mapResult ( iterator . return ( ) )
49
46
: Promise . resolve ( { value : undefined , done : true } ) ;
@@ -57,5 +54,5 @@ export function mapAsyncIterator<T, U>(
57
54
[ Symbol . asyncIterator ] ( ) {
58
55
return this ;
59
56
} ,
60
- } : $FlowFixMe ) ;
57
+ } ;
61
58
}
0 commit comments