`AbstractCursor[Symbol.asyncIterator]` is wrongly typed

XMLWordPrintableJSON

    • Type: Bug
    • Resolution: Fixed
    • Priority: Minor - P4
    • 4.1.0
    • Affects Version/s: None
    • Component/s: None
    • 2
    • None
    • Not Needed
    • None
    • None
    • None
    • None
    • None
    • 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.

              Assignee:
              Neal Beeken
              Reporter:
              Joao Dias
              None
              Votes:
              1 Vote for this issue
              Watchers:
              4 Start watching this issue

                Created:
                Updated:
                Resolved: