File tree 1 file changed +5
-3
lines changed
packages/library/src/base/util/iterators
1 file changed +5
-3
lines changed Original file line number Diff line number Diff line change @@ -18,15 +18,15 @@ export class SliceIterable<T> {
18
18
#extractIterator: (
19
19
v : NestedIterable < T > ,
20
20
) => Promise < Iterator < T | NestedIterable < T > > >
21
- #checkIterator: ( v : NestedIterable < T > ) => boolean
21
+ #checkIterator: ( v : NestedIterable < T > | T ) => boolean
22
22
23
23
// TODO: Helper functions are necessary because components
24
24
// do not follow the iterator protocol; when this change
25
25
// is implemented, the helpers can be removed.
26
26
constructor (
27
27
root : NestedIterable < T > ,
28
28
extractIterator = async ( v : NestedIterable < T > ) => v [ Symbol . iterator ] ( ) ,
29
- checkIterator = ( v : NestedIterable < T > ) => Symbol . iterator in v ,
29
+ checkIterator = ( v : NestedIterable < T > | T ) => Symbol . iterator in v ,
30
30
) {
31
31
this . #root = root
32
32
this . #extractIterator = extractIterator
@@ -82,7 +82,9 @@ export class SliceIterable<T> {
82
82
} else {
83
83
if ( this . #checkIterator( value ) ) {
84
84
outputStack . push ( value )
85
- iteratorStack . push ( await this . #extractIterator( value ) )
85
+ // We know that the value is an iterator
86
+ // courtesy of the condition above
87
+ iteratorStack . push ( await this . #extractIterator( value as NestedIterable < T > ) )
86
88
} else {
87
89
return { value : [ ...outputStack , value ] , done : false }
88
90
}
You can’t perform that action at this time.
0 commit comments