Uploaded image for project: 'Node.js Driver'
  1. Node.js Driver
  2. NODE-3510

incorrect `| void` in declaration of Promise overload of `Collection.rename()`

    • Type: Icon: Bug Bug
    • Resolution: Fixed
    • Priority: Icon: Unknown Unknown
    • 4.1.0
    • Affects Version/s: None
    • Component/s: None
    • Not Needed

      What problem are you facing?

      The 4.0.1 TS typings' overloaded declarations for Collection.rename() has a | void on the return type of an overload that should only return a Promise. If a method returns a Promise, it should never also be typed | void. The problem doesn't show up in any other overload declarations, so I assume this was just a bug, not an implied assertion about weird behavior of this method.

      I opened a PR to fix it: https://github.com/mongodb/node-mongodb-native/pull/2922

      Code is here: https://github.com/mongodb/node-mongodb-native/blob/dc6e2d6c5762ec62d1096a52d670b76b02aa2bf3/src/collection.ts#L624

      Expected: 

      rename(newName: string, options: RenameOptions): Promise<Collection> | void;

      Actual: 

      rename(newName: string, options: RenameOptions): Promise<Collection>;

      What driver and relevant dependency versions are you using?

      4.0.1

      Steps to reproduce?

      See https://github.com/mongodb/node-mongodb-native/pull/2922

            Assignee:
            neal.beeken@mongodb.com Neal Beeken
            Reporter:
            justin@hangle.io Justin Grant
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: