diff --git a/mongoose-paginate/mongoose-paginate-tests.ts b/mongoose-paginate/mongoose-paginate-tests.ts index 7857ffda33..42fc42be69 100644 --- a/mongoose-paginate/mongoose-paginate-tests.ts +++ b/mongoose-paginate/mongoose-paginate-tests.ts @@ -11,14 +11,15 @@ import { model, PaginateModel, PaginateOptions, - PaginateResult + PaginateResult, + Document } from 'mongoose'; import * as mongoosePaginate from 'mongoose-paginate'; import { Router, Request, Response } from 'express'; //#region Test Models -interface User { +interface User extends Document { email: string; username: string; password: string; @@ -32,8 +33,7 @@ const UserSchema: Schema = new Schema({ UserSchema.plugin(mongoosePaginate); -type UserModel = _UserModel & PaginateModel; -interface _UserModel {} +interface UserModel extends PaginateModel {}; let UserModel: UserModel = model('User', UserSchema) as UserModel; //#endregion diff --git a/mongoose-paginate/mongoose-paginate.d.ts b/mongoose-paginate/mongoose-paginate.d.ts index 5481c42775..c90e7550fd 100644 --- a/mongoose-paginate/mongoose-paginate.d.ts +++ b/mongoose-paginate/mongoose-paginate.d.ts @@ -26,16 +26,15 @@ declare module 'mongoose' { offset?: number; } - export type PaginateModel = _PaginateModel & Model; - interface _PaginateModel { + interface PaginateModel extends Model { paginate(query?: Object, options?: PaginateOptions, callback?: (err: any, result: PaginateResult) => void): Promise>; } - export function model( + export function model( name: string, schema?: Schema, collection?: string, - skipInit?: boolean): Statics & PaginateModel; + skipInit?: boolean): PaginateModel; } declare module 'mongoose-paginate' {