Merge pull request #32641 from frontendmonster/master

[@types/mongoose] Make "MongooseDocument.invalidate" value param optional
This commit is contained in:
Pranav Senthilnathan
2019-01-30 15:32:40 -08:00
committed by GitHub
2 changed files with 3 additions and 1 deletions
+2 -1
View File
@@ -16,6 +16,7 @@
// Dan Manastireanu <https://github.com/danmana>
// stablio <https://github.com/stablio>
// Emmanuel Gautier <https://github.com/emmanuelgautier>
// Frontend Monster <https://github.com/frontendmonster>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.3
@@ -1310,7 +1311,7 @@ declare module "mongoose" {
* @param kind optional kind property for the error
* @returns the current ValidationError, with all currently invalidated paths
*/
invalidate(path: string, errorMsg: string | NativeError, value: any, kind?: string): Error.ValidationError | boolean;
invalidate(path: string, errorMsg: string | NativeError, value?: any, kind?: string): Error.ValidationError | boolean;
/** Returns true if path was directly set and modified, else false. */
isDirectModified(path: string): boolean;
+1
View File
@@ -726,6 +726,7 @@ doc.execPopulate().then(function (arg) {
doc.get('path', Number);
doc.init(doc).init(doc, {});
doc.inspect();
doc.invalidate('path', new Error('hi')).toString();
doc.invalidate('path', new Error('hi'), 999).toString();
doc.isDirectModified('path').valueOf();
doc.isInit('path').valueOf();