-
Type: Bug
-
Resolution: Fixed
-
Priority: Minor - P4
-
Affects Version/s: None
-
Component/s: None
What problem are you facing?
We have our own cursor interface that basically whitelists certain operations and we use that in our code base instead of the official one but after updating to driver v4 we can no longer assign `FindCursor` to our cursor because the `Symbol.asyncIterator` type of `AbstractControl` is wrong.
What driver and relevant dependency versions are you using?
Version 4
Steps to reproduce?
This type:
class AbstractCursor<TSchema = any> { // ... [Symbol.asyncIterator](): AsyncIterator<TSchema | null>; // ... }
Should be:
class AbstractCursor<TSchema = any> { // ... [Symbol.asyncIterator](): AsyncIterator<TSchema>; // ... }
If `TSchema` CAN be `null`, then it's up to the caller to state so. The async iterator can never yield null unless the input type can be null and that's defined by TSchema.
- is duplicated by
-
NODE-3456 FindCursor [asyncIterator]
- Closed