diff --git a/test/types/populate.test.ts b/test/types/populate.test.ts index f354eaca17a..90a54adc534 100644 --- a/test/types/populate.test.ts +++ b/test/types/populate.test.ts @@ -227,4 +227,5 @@ async function _11532() { if (!leanResult) return; expectType(leanResult.child.name); + expectError(leanResult?.__v); } \ No newline at end of file diff --git a/types/index.d.ts b/types/index.d.ts index b1a18815483..cc343d8c287 100644 --- a/types/index.d.ts +++ b/types/index.d.ts @@ -1776,8 +1776,8 @@ declare module 'mongoose' { polygon(path: string, ...coordinatePairs: number[][]): this; /** Specifies paths which should be populated with other documents. */ - populate>(path: string | string[], select?: string | any, model?: string | Model, match?: any): QueryWithHelpers; - populate>(options: PopulateOptions | (PopulateOptions | string)[]): QueryWithHelpers; + populate(path: string | string[], select?: string | any, model?: string | Model, match?: any): QueryWithHelpers, DocType, THelpers, UnpackedIntersection>; + populate(options: PopulateOptions | (PopulateOptions | string)[]): QueryWithHelpers, DocType, THelpers, UnpackedIntersection>; /** Get/set the current projection (AKA fields). Pass `null` to remove the current projection. */ projection(): ProjectionFields | null;