Skip to content

Commit f370aaa

Browse files
committed
fix(types): make populate Paths generic consistently overwrite doc interface
Fix #11955
1 parent ce4d458 commit f370aaa

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

types/document.d.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -200,10 +200,10 @@ declare module 'mongoose' {
200200
$parent(): Document | undefined;
201201

202202
/** Populates document references. */
203-
populate<Paths = {}>(path: string | PopulateOptions | (string | PopulateOptions)[]): Promise<this & Paths>;
204-
populate<Paths = {}>(path: string | PopulateOptions | (string | PopulateOptions)[], callback: Callback<this & Paths>): void;
205-
populate<Paths = {}>(path: string, select?: string | AnyObject, model?: Model<any>, match?: AnyObject, options?: PopulateOptions): Promise<this & Paths>;
206-
populate<Paths = {}>(path: string, select?: string | AnyObject, model?: Model<any>, match?: AnyObject, options?: PopulateOptions, callback?: Callback<this & Paths>): void;
203+
populate<Paths = {}>(path: string | PopulateOptions | (string | PopulateOptions)[]): Promise<MergeType<this, Paths>>;
204+
populate<Paths = {}>(path: string | PopulateOptions | (string | PopulateOptions)[], callback: Callback<MergeType<this, Paths>>): void;
205+
populate<Paths = {}>(path: string, select?: string | AnyObject, model?: Model<any>, match?: AnyObject, options?: PopulateOptions): Promise<MergeType<this, Paths>>;
206+
populate<Paths = {}>(path: string, select?: string | AnyObject, model?: Model<any>, match?: AnyObject, options?: PopulateOptions, callback?: Callback<MergeType<this, Paths>>): void;
207207

208208
/** Gets _id(s) used during population of the given `path`. If the path was not populated, returns `undefined`. */
209209
populated(path: string): any;

0 commit comments

Comments
 (0)