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();