Skip to content

Commit 5b2545e

Browse files
committed
test: add test case covering code review comments from #14525
1 parent fe1ed86 commit 5b2545e

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

test/types/queries.test.ts

+24
Original file line numberDiff line numberDiff line change
@@ -612,3 +612,27 @@ function gh14473() {
612612
const query2: FilterQuery<D> = { deletedAt: { $lt: new Date() } };
613613
};
614614
}
615+
616+
async function gh14525() {
617+
type BeAnObject = Record<string, any>;
618+
619+
interface SomeDoc {
620+
something: string;
621+
func(this: TestDoc): string;
622+
}
623+
624+
interface PluginExtras {
625+
pfunc(): number;
626+
}
627+
628+
type TestDoc = Document<unknown, BeAnObject, SomeDoc> & PluginExtras;
629+
630+
type ModelType = Model<SomeDoc, BeAnObject, PluginExtras, BeAnObject>;
631+
632+
const doc = await ({} as ModelType).findOne({}).populate('test').orFail().exec();
633+
634+
doc.func();
635+
636+
let doc2 = await ({} as ModelType).create({});
637+
doc2 = await ({} as ModelType).findOne({}).populate('test').orFail().exec();
638+
}

0 commit comments

Comments
 (0)