diff --git a/test/types/queries.test.ts b/test/types/queries.test.ts index d0af45a42a5..297360b62d1 100644 --- a/test/types/queries.test.ts +++ b/test/types/queries.test.ts @@ -612,3 +612,27 @@ function gh14473() { const query2: FilterQuery = { deletedAt: { $lt: new Date() } }; }; } + +async function gh14525() { + type BeAnObject = Record; + + interface SomeDoc { + something: string; + func(this: TestDoc): string; + } + + interface PluginExtras { + pfunc(): number; + } + + type TestDoc = Document & PluginExtras; + + type ModelType = Model; + + const doc = await ({} as ModelType).findOne({}).populate('test').orFail().exec(); + + doc.func(); + + let doc2 = await ({} as ModelType).create({}); + doc2 = await ({} as ModelType).findOne({}).populate('test').orFail().exec(); +}