Merge pull request #30754 from wosevision/mongoose-posthook-overload

Mongoose posthook overload
This commit is contained in:
Mine Starks
2018-11-28 19:30:13 -08:00
committed by GitHub
2 changed files with 4 additions and 4 deletions
+2 -2
View File
@@ -811,11 +811,11 @@ declare module "mongoose" {
* @param fn callback
*/
post<T extends Document>(method: string, fn: (
error: mongodb.MongoError, doc: T, next: (err?: NativeError) => void
doc: T, next: (err?: NativeError) => void
) => void): this;
post<T extends Document>(method: string, fn: (
doc: T, next: (err?: NativeError) => void
error: mongodb.MongoError, doc: T, next: (err?: NativeError) => void
) => void): this;
/**
+2 -2
View File
@@ -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());
})