Skip to content

Commit 6eb4edd

Browse files
authored
chore: stricten MongoClient.connect() return type (#3080)
This method always returns the MongoClient on which it was called.
1 parent 9613835 commit 6eb4edd

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/mongo_client.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -413,9 +413,9 @@ export class MongoClient extends TypedEventEmitter<MongoClientEvents> {
413413
*
414414
* @see docs.mongodb.org/manual/reference/connection-string/
415415
*/
416-
connect(): Promise<MongoClient>;
417-
connect(callback: Callback<MongoClient>): void;
418-
connect(callback?: Callback<MongoClient>): Promise<MongoClient> | void {
416+
connect(): Promise<this>;
417+
connect(callback: Callback<this>): void;
418+
connect(callback?: Callback<this>): Promise<this> | void {
419419
if (callback && typeof callback !== 'function') {
420420
throw new MongoInvalidArgumentError('Method `connect` only accepts a callback');
421421
}

0 commit comments

Comments
 (0)