Skip to content

Commit

Permalink
Added prepaginate string support for TypeScript
Browse files Browse the repository at this point in the history
  • Loading branch information
NishargShah authored Sep 26, 2024
1 parent 05f60b5 commit c6b1dc5
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions types/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
// and LiRen Tu <https://github.com/tuliren> for their contribution

declare module "mongoose" {
type PrePaginatePipelineStage = PipelineStage | '__PREPAGINATE__';

interface CustomLabels<T = string | undefined | boolean> {
totalDocs?: T | undefined;
docs?: T | undefined;
Expand Down Expand Up @@ -64,7 +66,7 @@ declare module "mongoose" {

interface AggregatePaginateModel<D> extends Model<D> {
aggregatePaginate<T>(
query?: Aggregate<T[]>,
query?: Aggregate<T[]> | PrePaginatePipelineStage[],
options?: PaginateOptions,
callback?: (err: any, result: AggregatePaginateResult<T>) => void,
): Promise<AggregatePaginateResult<T>>;
Expand All @@ -85,4 +87,4 @@ declare namespace mongooseAggregatePaginate {

declare namespace _ {
const aggregatePaginate: { options: mongoose.PaginateOptions };
}
}

0 comments on commit c6b1dc5

Please sign in to comment.