From 0a08e47064d70d2790152631b0ba635d615e5f82 Mon Sep 17 00:00:00 2001 From: Ethan Resnick Date: Sun, 27 May 2018 01:45:07 -0400 Subject: [PATCH] feat(mongoose): Document Connection.then/catch --- types/mongoose/index.d.ts | 5 ++++- types/mongoose/mongoose-tests.ts | 5 +++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/types/mongoose/index.d.ts b/types/mongoose/index.d.ts index 50496fc9da..ec309669bc 100644 --- a/types/mongoose/index.d.ts +++ b/types/mongoose/index.d.ts @@ -385,7 +385,7 @@ declare module "mongoose" { $format(arg: any): string; /** Debug print helper */ $print(name: any, i: any, args: any[]): void; - /** Retreives information about this collections indexes. */ + /** Retrieves information about this collections indexes. */ getIndexes(): any; } @@ -403,6 +403,9 @@ declare module "mongoose" { /** Expose the possible connection states. */ static STATES: any; + + then: Promise["then"]; + catch: Promise["catch"]; } /* diff --git a/types/mongoose/mongoose-tests.ts b/types/mongoose/mongoose-tests.ts index fc43549f8e..3ba415d909 100644 --- a/types/mongoose/mongoose-tests.ts +++ b/types/mongoose/mongoose-tests.ts @@ -37,6 +37,11 @@ const connection3: null = mongoose.connect(connectUri, function (error) { var mongooseConnection: mongoose.Connection = mongoose.createConnection(); mongooseConnection.dropDatabase().then(()=>{}); mongooseConnection.dropCollection('foo').then(()=>{}); +mongoose.createConnection(connectUri).then((conn)=> { + return conn.collections; +}, () => { + +}); mongoose.createConnection(connectUri).open(''); mongoose.createConnection(connectUri, { db: {