diff --git a/index.d.ts b/index.d.ts index ed29d79d375..17c99e0d504 100644 --- a/index.d.ts +++ b/index.d.ts @@ -99,7 +99,7 @@ declare module 'mongoose' { */ export function isValidObjectId(v: any): boolean; - export function model(name: string, schema?: Schema, collection?: string, skipInit?: boolean): Model; + export function model(name: string, schema?: Schema, collection?: string, skipInit?: boolean): Model; export function model, TQueryHelpers = {}>( name: string, schema?: Schema, diff --git a/test/typescript/queries.ts b/test/typescript/queries.ts index da269afbb75..1d67661cb17 100644 --- a/test/typescript/queries.ts +++ b/test/typescript/queries.ts @@ -17,7 +17,7 @@ interface ITest extends Document { tags?: string[]; } -const Test = model('Test', schema); +const Test = model>('Test', schema); Test.find().byName('test').orFail().exec().then(console.log);