fixing a Promise bug in type definition (#9334)

* fixing a Promise bug in  type definition

* add Promise to Mongoose object
This commit is contained in:
Thomas Puttkamer
2016-05-17 05:39:07 +02:00
committed by Horiuchi_H
parent 398bd74211
commit 5e1ca2b9ef

View File

@@ -40,6 +40,7 @@ declare module "mongoose" {
mquery: any;
version: string;
connection: Connection;
Promise: any;
}
export interface Connection extends NodeJS.EventEmitter {
@@ -307,8 +308,8 @@ declare module "mongoose" {
circle(area: Object): Query<T>;
circle(path: string, area: Object): Query<T>;
comment(val: any): Query<T>;
count(callback?: (err: any, count: number) => void): Query<T>;
count(criteria: Object, callback?: (err: any, count: number) => void): Query<T>;
count(callback?: (err: any, count: number) => void): Query<number>;
count(criteria: Object, callback?: (err: any, count: number) => void): Query<number>;
distinct(callback?: (err: any, res: T) => void): Query<T>;
distinct(field: string, callback?: (err: any, res: T) => void): Query<T>;
distinct(criteria: Object, field: string, callback?: (err: any, res: T) => void): Query<T>;
@@ -481,7 +482,7 @@ declare module "mongoose" {
export class Promise<T> {
constructor(fn?: (err: any, result: T) => void);
then<U>(onFulFill: (result: T) => void, onReject?: (err: any) => void): Promise<U>;
then<U>(onFulFill: (result: T) => void | U | Promise<U>, onReject?: (err: any) => void | U | Promise<U>): Promise<U>;
end(): void;
fulfill(result: T): Promise<T>;