Skip to content

Commit

Permalink
test: add test case covering code review comments from #14525
Browse files Browse the repository at this point in the history
  • Loading branch information
vkarpov15 committed Apr 24, 2024
1 parent fe1ed86 commit 5b2545e
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions test/types/queries.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -612,3 +612,27 @@ function gh14473() {
const query2: FilterQuery<D> = { deletedAt: { $lt: new Date() } };
};
}

async function gh14525() {
type BeAnObject = Record<string, any>;

interface SomeDoc {
something: string;
func(this: TestDoc): string;
}

interface PluginExtras {
pfunc(): number;
}

type TestDoc = Document<unknown, BeAnObject, SomeDoc> & PluginExtras;

type ModelType = Model<SomeDoc, BeAnObject, PluginExtras, BeAnObject>;

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();
}

0 comments on commit 5b2545e

Please sign in to comment.