Skip to content

Commit

Permalink
fix(index.d.ts): work around #9969 for #9850
Browse files Browse the repository at this point in the history
  • Loading branch information
vkarpov15 committed Mar 3, 2021
1 parent 964dfd5 commit 0015765
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ declare module 'mongoose' {
*/
export function isValidObjectId(v: any): boolean;

export function model<T extends Document, TQueryHelpers = {}>(name: string, schema?: Schema<any>, collection?: string, skipInit?: boolean): Model<T, TQueryHelpers>;
export function model<T extends Document>(name: string, schema?: Schema<any>, collection?: string, skipInit?: boolean): Model<T>;
export function model<T extends Document, U extends Model<T, TQueryHelpers>, TQueryHelpers = {}>(
name: string,
schema?: Schema<T, U>,
Expand Down
2 changes: 1 addition & 1 deletion test/typescript/queries.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ interface ITest extends Document {
tags?: string[];
}

const Test = model<ITest, QueryHelpers>('Test', schema);
const Test = model<ITest, Model<ITest, QueryHelpers>>('Test', schema);

Test.find().byName('test').orFail().exec().then(console.log);

Expand Down

0 comments on commit 0015765

Please sign in to comment.