If you use both mongoose-paginate-v2 and mongoose-aggregate-paginate-v2 the type files cause a conflict on build.
node_modules/@types/mongoose-aggregate-paginate-v2/index.d.ts:14:9 - error TS2717: Subsequent property declarations must have the same type. Property 'totalDocs' must be of type 'T', but here has type 'string'.
14 totalDocs?: string | undefined;
~~~~~~~~~
node_modules/mongoose-paginate-v2/index.d.ts:3:5
3 totalDocs?: T;
~~~~~~~~~
'totalDocs' was also declared here.
node_modules/@types/mongoose-aggregate-paginate-v2/index.d.ts:15:9 - error TS2717: Subsequent property declarations must have the same type. Property 'limit' must be of type 'T', but here has type 'string'.
15 limit?: string | undefined;
~~~~~
node_modules/mongoose-paginate-v2/index.d.ts:5:5
5 limit?: T;
~~~~~
'limit' was also declared here.
node_modules/@types/mongoose-aggregate-paginate-v2/index.d.ts:16:9 - error TS2717: Subsequent property declarations must have the same type. Property 'page' must be of type 'T', but here has type 'string'.
16 page?: string | undefined;
~~~~
node_modules/mongoose-paginate-v2/index.d.ts:6:5
6 page?: T;
~~~~
'page' was also declared here.
node_modules/@types/mongoose-aggregate-paginate-v2/index.d.ts:17:9 - error TS2717: Subsequent property declarations must have the same type. Property 'totalPages' must be of type 'T', but here has type 'string'.
17 totalPages?: string | undefined;
~~~~~~~~~~
node_modules/mongoose-paginate-v2/index.d.ts:11:5
11 totalPages?: T;
~~~~~~~~~~
'totalPages' was also declared here.
node_modules/@types/mongoose-aggregate-paginate-v2/index.d.ts:18:9 - error TS2717: Subsequent property declarations must have the same type. Property 'docs' must be of type 'T', but here has type 'string'.
18 docs?: string | undefined;
~~~~
node_modules/mongoose-paginate-v2/index.d.ts:4:5
4 docs?: T;
~~~~
'docs' was also declared here.
node_modules/@types/mongoose-aggregate-paginate-v2/index.d.ts:19:9 - error TS2717: Subsequent property declarations must have the same type. Property 'nextPage' must be of type 'T', but here has type 'string'.
19 nextPage?: string | undefined;
~~~~~~~~
node_modules/mongoose-paginate-v2/index.d.ts:7:5
7 nextPage?: T;
~~~~~~~~
'nextPage' was also declared here.
node_modules/@types/mongoose-aggregate-paginate-v2/index.d.ts:20:9 - error TS2717: Subsequent property declarations must have the same type. Property 'prevPage' must be of type 'T', but here has type 'string'.
20 prevPage?: string | undefined;
~~~~~~~~
node_modules/mongoose-paginate-v2/index.d.ts:8:5
8 prevPage?: T;
~~~~~~~~
'prevPage' was also declared here.
node_modules/@types/mongoose-aggregate-paginate-v2/index.d.ts:21:9 - error TS2717: Subsequent property declarations must have the same type. Property 'pagingCounter' must be of type 'T', but here has type 'string'.
21 pagingCounter?: string | undefined;
~~~~~~~~~~~~~
node_modules/mongoose-paginate-v2/index.d.ts:12:5
12 pagingCounter?: T;
~~~~~~~~~~~~~
'pagingCounter' was also declared here.
node_modules/@types/mongoose-aggregate-paginate-v2/index.d.ts:22:9 - error TS2717: Subsequent property declarations must have the same type. Property 'hasPrevPage' must be of type 'T', but here has type 'string'.
22 hasPrevPage?: string | undefined;
~~~~~~~~~~~
node_modules/mongoose-paginate-v2/index.d.ts:10:5
10 hasPrevPage?: T;
~~~~~~~~~~~
'hasPrevPage' was also declared here.
node_modules/@types/mongoose-aggregate-paginate-v2/index.d.ts:23:9 - error TS2717: Subsequent property declarations must have the same type. Property 'hasNextPage' must be of type 'T', but here has type 'string'.
23 hasNextPage?: string | undefined;
~~~~~~~~~~~
node_modules/mongoose-paginate-v2/index.d.ts:9:5
9 hasNextPage?: T;
~~~~~~~~~~~
'hasNextPage' was also declared here.
Found 10 errors.
The solution I found was to update the types in index.d.ts for CustomLabels to match the same types as mongoose-paginate-v2.
If you use both
mongoose-paginate-v2
andmongoose-aggregate-paginate-v2
the type files cause a conflict on build.The solution I found was to update the types in
index.d.ts
for CustomLabels to match the same types asmongoose-paginate-v2
.Before
After