From c6b1dc567e78c7293fd594de7b4f742ed0546f4b Mon Sep 17 00:00:00 2001 From: Nisharg Shah Date: Fri, 27 Sep 2024 03:49:35 +0530 Subject: [PATCH] Added prepaginate string support for TypeScript --- types/index.d.ts | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/types/index.d.ts b/types/index.d.ts index e5ab0b6..e43a63f 100644 --- a/types/index.d.ts +++ b/types/index.d.ts @@ -5,6 +5,8 @@ // and LiRen Tu for their contribution declare module "mongoose" { + type PrePaginatePipelineStage = PipelineStage | '__PREPAGINATE__'; + interface CustomLabels { totalDocs?: T | undefined; docs?: T | undefined; @@ -64,7 +66,7 @@ declare module "mongoose" { interface AggregatePaginateModel extends Model { aggregatePaginate( - query?: Aggregate, + query?: Aggregate | PrePaginatePipelineStage[], options?: PaginateOptions, callback?: (err: any, result: AggregatePaginateResult) => void, ): Promise>; @@ -85,4 +87,4 @@ declare namespace mongooseAggregatePaginate { declare namespace _ { const aggregatePaginate: { options: mongoose.PaginateOptions }; -} \ No newline at end of file +}