aravindnc / mongoose-paginate-v2

A custom pagination library for Mongoose with customizable labels.

Home Page:https://www.npmjs.com/package/mongoose-paginate-v2

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

error in typescript after npm i: version 1.3.9; types version 1.3.2

kalitas opened this issue · comments

node_modules/@types/mongoose-paginate-v2/index.d.ts:73:9 - error TS2411: Property 'hasPrevPage' of type 'boolean' is not assignable to string index type 'number | T[]'.

73 hasPrevPage: boolean;
~~~~~~~~~~~

node_modules/@types/mongoose-paginate-v2/index.d.ts:74:9 - error TS2411: Property 'hasNextPage' of type 'boolean' is not assignable to string index type 'number | T[]'.

74 hasNextPage: boolean;
~~~~~~~~~~~

Sorry @kalitas I'm not the one maintaining the TS version.

Sorry I'm not proficient in TS though. Let's see if somebody can contribute.

I added a pull request and waiting for approval..

I believe that this error is occurring by the [customLabel] property inside the PaginateResult interface.

Look that the error message is saying that the [nextPage / prevPage / hasPrevPage / hasNextPage] type definitions is not assignable to "string index [number | T [] | undefined] - property [customLabel] type definitions.

Addding the missing types "null and boolean" (from nextPage / prevPage / hasPrevPage / hasNextPage props) at the customLabel definition, the error is fixed.

Can someone tell If i'm right?