Skip to content

Commit c0b492c

Browse files
authored
Merge pull request #13304 from jeffersonlipsky/patch-1
Update document.d.ts set function params
2 parents a2040f6 + 429f608 commit c0b492c

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

types/document.d.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -90,9 +90,9 @@ declare module 'mongoose' {
9090
$session(session?: ClientSession | null): ClientSession | null;
9191

9292
/** Alias for `set()`, used internally to avoid conflicts */
93-
$set(path: string, val: any, type: any, options?: DocumentSetOptions): this;
94-
$set(path: string, val: any, options?: DocumentSetOptions): this;
95-
$set(value: any): this;
93+
$set(path: string | Record<string, any>, val: any, type: any, options?: DocumentSetOptions): this;
94+
$set(path: string | Record<string, any>, val: any, options?: DocumentSetOptions): this;
95+
$set(value: string | Record<string, any>): this;
9696

9797
/** Set this property to add additional query filters when Mongoose saves this document and `isNew` is false. */
9898
$where: Record<string, unknown>;
@@ -216,9 +216,9 @@ declare module 'mongoose' {
216216
schema: Schema;
217217

218218
/** Sets the value of a path, or many paths. */
219-
set(path: string, val: any, type: any, options?: any): this;
220-
set(path: string, val: any, options?: any): this;
221-
set(value: any): this;
219+
set(path: string | Record<string, any>, val: any, type: any, options?: DocumentSetOptions): this;
220+
set(path: string | Record<string, any>, val: any, options?: DocumentSetOptions): this;
221+
set(value: string | Record<string, any>): this;
222222

223223
/** The return value of this method is used in calls to JSON.stringify(doc). */
224224
toJSON<T = Require_id<DocType>>(options?: ToObjectOptions & { flattenMaps?: true }): FlattenMaps<T>;

0 commit comments

Comments
 (0)