From c6fd7f780a626535cddd3454b6f2a621ffb397a5 Mon Sep 17 00:00:00 2001 From: Jason Neal <88398073+jneal-afs@users.noreply.github.com> Date: Fri, 29 Oct 2021 21:06:06 -0400 Subject: [PATCH 1/2] Fix ts types for query set --- index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/index.d.ts b/index.d.ts index 27b8f348745..fc969e469c3 100644 --- a/index.d.ts +++ b/index.d.ts @@ -2442,7 +2442,7 @@ declare module 'mongoose' { * This is useful for query middleware so you can add an update regardless * of whether you use `updateOne()`, `updateMany()`, `findOneAndUpdate()`, etc. */ - set(path: string, value: any): this; + set(path: string | Record, value: any): this; /** Sets query options. Some options only make sense for certain operations. */ setOptions(options: QueryOptions, overwrite?: boolean): this; From d205c4d8a3560dd432eace40a0a5acf913726dd2 Mon Sep 17 00:00:00 2001 From: Jason Neal <88398073+jneal-afs@users.noreply.github.com> Date: Fri, 29 Oct 2021 21:08:58 -0400 Subject: [PATCH 2/2] make value optional --- index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/index.d.ts b/index.d.ts index fc969e469c3..695fe60b3b4 100644 --- a/index.d.ts +++ b/index.d.ts @@ -2442,7 +2442,7 @@ declare module 'mongoose' { * This is useful for query middleware so you can add an update regardless * of whether you use `updateOne()`, `updateMany()`, `findOneAndUpdate()`, etc. */ - set(path: string | Record, value: any): this; + set(path: string | Record, value?: any): this; /** Sets query options. Some options only make sense for certain operations. */ setOptions(options: QueryOptions, overwrite?: boolean): this;