fixes return types of some promises that were missed

This commit is contained in:
Simon
2016-07-16 22:28:34 -04:00
parent 95eb7b2527
commit 1b755999ed
2 changed files with 30 additions and 3 deletions
+25
View File
@@ -1024,6 +1024,31 @@ mongoose.model('')
arg.b.toFixed;
});
mongoose.model('').findOne({})
.then(function (arg) {
arg.save;
return 2;
}).then(function (num) {
num.toFixed;
return new Promise<string>((resolve, reject) => {
resolve('str');
});
}).then(function (str) {
str.toLowerCase;
});
mongoose.model('').aggregate()
.then(function (arg) {
return 2;
}).then(function (num) {
num.toFixed;
return new Promise<string>((resolve, reject) => {
resolve('str');
});
}).then(function (str) {
str.toLowerCase;
});
/* pluggable promise */
mongoose.Promise = Promise;
mongoose.Promise.race;
+5 -3
View File
@@ -1307,7 +1307,7 @@ declare module "mongoose" {
* resolved with either the doc(s) or rejected with the error.
* Like .then(), but only takes a rejection handler.
*/
catch(reject?: (err: any) => void): Promise<T>;
catch<TRes>(reject?: (err: any) => void | TRes | PromiseLike<TRes>): Promise<TRes>;
/**
* DEPRECATED Alias for circle
@@ -1651,7 +1651,8 @@ declare module "mongoose" {
}): this;
/** Executes this query and returns a promise */
then(resolve?: (res: T) => void, reject?: (err: any) => void): Promise<T>;
then<TRes>(resolve?: (res: T) => void | TRes | PromiseLike<TRes>,
reject?: (err: any) => void | TRes | PromiseLike<TRes>): Promise<TRes>;
/**
* Converts this query to a customized, reusable query
@@ -2071,7 +2072,8 @@ declare module "mongoose" {
sort(arg: string | Object): this;
/** Provides promise for aggregate. */
then(resolve?: (val: T) => void, reject?: (err: any) => void): Promise<T>
then<TRes>(resolve?: (val: T) => void | TRes | PromiseLike<TRes>,
reject?: (err: any) => void | TRes | PromiseLike<TRes>): Promise<TRes>
/**
* Appends new custom $unwind operator(s) to this aggregate pipeline.