I'm trying to setup mongoose-paginate-v2 in my project but there is no way, I'm trying to build my code but I get these three errors. Did you have any idea why? Thanks
node_modules/@types/mongoose-paginate-v2/index.d.ts:34:21 - error TS2304: Cannot find name 'CollationOptions'.
34 collation?: CollationOptions | undefined;
~~~~~~~~~~~~~~~~
node_modules/@types/mongoose-paginate-v2/index.d.ts:45:19 - error TS2304: Cannot find name 'QueryFindOptions'.
45 options?: QueryFindOptions | undefined;
~~~~~~~~~~~~~~~~
src/models/book.model.ts:150:10 - error TS2339: Property 'paginate' does not exist on type 'Model<any, any, any>'.
150 this.paginate(query, options, function (err: any, result: any) {
~~~~~~~~
My Package.json about
"mongoose-paginate-v2": "^1.3.9",
"@types/mongoose-paginate-v2": "^1.3.9",
Lets assume someone have added dependencies of mongoose in package.json and prefix on version is like "^7.2.4"
It is not causing you any issue or error for now but as time goes and versioning of mongoose changes. Try to use "~7.2.4" instead of "^7.2.4"
~version “Approximately equivalent to version”, will update you to all future patch versions, without incrementing the minor version. ~1.2.3 will use releases from 1.2.3 to <1.3.0.
^version “Compatible with version”, will update you to all future minor/patch versions, without incrementing the major version. ^2.3.4 will use releases from 2.3.4 to <3.0.0.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.