From 9520a876d77f8b0d14a53155d01b2690c339f2f0 Mon Sep 17 00:00:00 2001 From: frontendmonster Date: Wed, 30 Jan 2019 23:22:39 +0330 Subject: [PATCH] Make MongooseDocument.invalidate value param optional --- types/mongoose/index.d.ts | 3 ++- types/mongoose/mongoose-tests.ts | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/types/mongoose/index.d.ts b/types/mongoose/index.d.ts index b7d3b5d9c6..800b37f520 100644 --- a/types/mongoose/index.d.ts +++ b/types/mongoose/index.d.ts @@ -16,6 +16,7 @@ // Dan Manastireanu // stablio // Emmanuel Gautier +// Frontend Monster // 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; diff --git a/types/mongoose/mongoose-tests.ts b/types/mongoose/mongoose-tests.ts index 8e6a60fdc7..30b5b51a84 100644 --- a/types/mongoose/mongoose-tests.ts +++ b/types/mongoose/mongoose-tests.ts @@ -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();