We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 67a09d4 commit 18968f9Copy full SHA for 18968f9
src/serializers/iterators.ts
@@ -41,7 +41,10 @@ export const DefaultIteratorSerializer = (rootSerializer: Serializer): Serialize
41
})
42
43
export const isIterator = (thing: any): thing is Iterator<any> | AsyncIterator<any> =>
44
- thing && typeof thing === "object" && "next" in thing && typeof thing.next === "function"
+ thing && typeof thing === "object" && (
45
+ typeof thing.next === "function" ||
46
+ typeof (thing as AsyncIterable<unknown>)[Symbol.asyncIterator] === "function"
47
+ )
48
49
export const isSerializedIterator = (thing: any): thing is SerializedIterator =>
50
thing && typeof thing === "object" && "__iterator_marker" in thing && thing.__iterator_marker === "$$iterator"
0 commit comments