diff --git a/types/mongoose/index.d.ts b/types/mongoose/index.d.ts index 5963be87ed..3672b75b8f 100644 --- a/types/mongoose/index.d.ts +++ b/types/mongoose/index.d.ts @@ -811,11 +811,11 @@ declare module "mongoose" { * @param fn callback */ post(method: string, fn: ( - error: mongodb.MongoError, doc: T, next: (err?: NativeError) => void + doc: T, next: (err?: NativeError) => void ) => void): this; post(method: string, fn: ( - doc: T, next: (err?: NativeError) => void + error: mongodb.MongoError, doc: T, next: (err?: NativeError) => void ) => void): this; /** diff --git a/types/mongoose/mongoose-tests.ts b/types/mongoose/mongoose-tests.ts index c8873f85b3..f713ba8538 100644 --- a/types/mongoose/mongoose-tests.ts +++ b/types/mongoose/mongoose-tests.ts @@ -491,12 +491,12 @@ preHookTestSchemaArr.push( ); schema -.post('save', function (error, doc, next) { +.post('save', function (error: mongoose.Error, doc: mongoose.Document, next: (err?: mongoose.NativeError) => void) { error.stack; doc.model; next.apply; }) -.post('save', function (doc: mongoose.Document, next: Function) { +.post('save', function (doc: mongoose.Document, next: (err?: mongoose.NativeError) => void) { doc.model; next(new Error()); })