Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Property 'paginateSubDocs' does not exist error when using typescipt #181

Open
A-Ghattas opened this issue Nov 15, 2022 · 0 comments
Open

Comments

@A-Ghattas
Copy link

Describe the bug
Property 'paginateSubDocs' does not exist while paginate works correctly when using mongoose-paginate-v2 in a typescript project

To Reproduce
Add mongoose-paginate-v2 to a typescript project
Add it as a plugin to one of the schema
Add PaginateModel as an extenion of your model
Call paginateSubDocs (For exemple User.paginateSubDocs(...))

Expected behavior
paginateSubDocs should be a recognized method of type PaginateModel

Additional context
I think the solution is to add the method declaration in the file index.d.ts inside of the interface paginateModel in line 102 because the only declared method here is paginate

interface PaginateModel<T, TQueryHelpers = {}, TMethods = {}>
    extends Model<T, TQueryHelpers, TMethods> {
    paginate<O extends PaginateOptions>(
      query?: FilterQuery<T>,
      options?: O,
      callback?: (
        err: any,
        result: PaginateResult<PaginateDocument<T, TMethods, O>>
      ) => void
    ): Promise<PaginateResult<PaginateDocument<T, TMethods, O>>>;
  }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant