fixes return type of mongoosethenable

This commit is contained in:
Simon
2016-07-16 22:39:41 -04:00
parent 1b755999ed
commit b301b3e81c
2 changed files with 5 additions and 4 deletions

View File

@@ -28,7 +28,7 @@ mongoose.connect(connectUri, {
autoIndex: true
},
mongos: true
}).then(cb);
}).then(cb).onReject;
mongoose.connect(connectUri, function (error) {
error.stack;
});
@@ -46,7 +46,7 @@ mongoose.createConnection('localhost', 'database', 3000, {
autoIndex: false
}
}).open('');
mongoose.disconnect(cb).then(cb);
mongoose.disconnect(cb).then(cb).fulfill;
mongoose.get('test');
mongoose.model('Actor', new mongoose.Schema({
name: String

View File

@@ -309,13 +309,14 @@ declare module "mongoose" {
* Ability to use mongoose object as a pseudo-promise so .connect().then()
* and .disconnect().then() are viable.
*/
static then(onFulfill?: () => void, onRejected?: (err: mongodb.MongoError) => void): typeof MongooseThenable;
static then<TRes>(onFulfill?: () => void | TRes | PromiseLike<TRes>,
onRejected?: (err: mongodb.MongoError) => void | TRes | PromiseLike<TRes>): Promise<TRes>;
/**
* Ability to use mongoose object as a pseudo-promise so .connect().then()
* and .disconnect().then() are viable.
*/
static catch(onRejected?: (err: mongodb.MongoError) => void): typeof MongooseThenable;
static catch<TRes>(onRejected?: (err: mongodb.MongoError) => void | TRes | PromiseLike<TRes>): Promise<TRes>;
}
class CastError extends _mongoose.Error {