mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-10-04 23:07:06 +00:00
Merge pull request #13859 from Snorremd/master
Fix: Change MongooseDocument.set() return type from void to this. See http://mongoosejs.com/docs/api.html#document_Document-set Modify doc.set() examples in test file to chain the set method in order to test the "this" return type.
This commit is contained in:
Vendored
+3
-3
@@ -1010,9 +1010,9 @@ declare module "mongoose" {
|
||||
* @param type optionally specify a type for "on-the-fly" attributes
|
||||
* @param options optionally specify options that modify the behavior of the set
|
||||
*/
|
||||
set(path: string, val: any, options?: Object): void;
|
||||
set(path: string, val: any, type: any, options?: Object): void;
|
||||
set(value: Object): void;
|
||||
set(path: string, val: any, options?: Object): this;
|
||||
set(path: string, val: any, type: any, options?: Object): this;
|
||||
set(value: Object): this;
|
||||
|
||||
/**
|
||||
* The return value of this method is used in calls to JSON.stringify(doc).
|
||||
|
||||
@@ -449,10 +449,7 @@ doc.populate(function (err, doc) {
|
||||
});
|
||||
});
|
||||
doc.populated('path');
|
||||
doc.set('path', 999, {});
|
||||
doc.set({
|
||||
path: 999
|
||||
});
|
||||
doc.set('path', 999, {}).set({ path: 999 });
|
||||
doc.toJSON({
|
||||
getters: true,
|
||||
virtuals: false
|
||||
@@ -1494,4 +1491,4 @@ const extended: mongoose.Model<extended> = base.discriminator<extended>('extende
|
||||
const x = new extended({
|
||||
username: 'hi', // required in baseSchema
|
||||
email: 'beddiw', // required in extededSchema
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user