Error calling 'paginate' after import schema within plugin Error calling 'paginate' after import schema within plugin mongoose mongoose

Error calling 'paginate' after import schema within plugin


The solution is include a interface with extend the PaginateModel to my Schema.

'use strict'import { PaginateModel, Document, Schema, model } from 'mongoose';import * as mongoosePaginate from 'mongoose-paginate';interface IArtist extends Document {    name: String;    description: String;    image: String;}const ArtistSchema: Schema = new Schema({    name: String,    description: String,    image: String});ArtistSchema.plugin(mongoosePaginate);interface ArtistModel<T extends Document> extends PaginateModel<T> {}export const ArtistModel: ArtistModel<IArtist> = model<IArtist>('Artist', ArtistSchema);