From 5e1ca2b9ef1971a6b08d9fb6d9277f20c61887f2 Mon Sep 17 00:00:00 2001 From: Thomas Puttkamer Date: Tue, 17 May 2016 05:39:07 +0200 Subject: [PATCH] fixing a Promise bug in type definition (#9334) * fixing a Promise bug in type definition * add Promise to Mongoose object --- mongoose/mongoose.d.ts | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/mongoose/mongoose.d.ts b/mongoose/mongoose.d.ts index 00915d3473..a2aabc0128 100644 --- a/mongoose/mongoose.d.ts +++ b/mongoose/mongoose.d.ts @@ -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; circle(path: string, area: Object): Query; comment(val: any): Query; - count(callback?: (err: any, count: number) => void): Query; - count(criteria: Object, callback?: (err: any, count: number) => void): Query; + count(callback?: (err: any, count: number) => void): Query; + count(criteria: Object, callback?: (err: any, count: number) => void): Query; distinct(callback?: (err: any, res: T) => void): Query; distinct(field: string, callback?: (err: any, res: T) => void): Query; distinct(criteria: Object, field: string, callback?: (err: any, res: T) => void): Query; @@ -481,7 +482,7 @@ declare module "mongoose" { export class Promise { constructor(fn?: (err: any, result: T) => void); - then(onFulFill: (result: T) => void, onReject?: (err: any) => void): Promise; + then(onFulFill: (result: T) => void | U | Promise, onReject?: (err: any) => void | U | Promise): Promise; end(): void; fulfill(result: T): Promise;