-
Notifications
You must be signed in to change notification settings - Fork 72
Description
Describe the bug
Version 5.0.2 overwrites mongoDB/mongoose types that break other mongoDB/mongoose-dependent packages, like connect-mongo. Not sure which set of types are actually doing the harm.
Environment
- I'm using
multer-gridfs-storage
version 5.0.2. - My installed MongoDb version is 4.81. <-- I do not need this in this package, and simply installed it to see if it would address the issue. It did not.
- I have Multer 1.4.4-lts.1 installed to upload files. <-- also tried 1.4.5-lts.1, no luck.
- The Node version used to run the code is 16.14.0.
To Reproduce
npm i connect-mongo -> package.json shows "connect-mongo": "^4.6.0";
npm i multer@1.4.4-lts.1 -> package.json shows "multer": "^1.4.4-lts.1";
npm i multer-gridfs-storage -> npm shows warnings/errors addressed in #490 , package.json shows "multer-gridfs-storage": "^5.0.2".
Upon build, the following errors are generated:
tsc
node_modules/connect-mongo/build/main/lib/MongoStore.d.ts:2:55 - error TS2305: Module '"mongodb"' has no exported member 'WriteConcernSettings'.
2 import { Collection, MongoClient, MongoClientOptions, WriteConcernSettings } from 'mongodb';
~~~~~~~~~~~~~~~~~~~~
node_modules/mongoose/types/aggregate.d.ts:22:25 - error TS2694: Namespace '"C:/Users/servi/Desktop/d-drive/cctx/oba-express/node_modules/@types/mongodb/index"' has no exported member 'CollationOptions'.
22 collation?: mongodb.CollationOptions;
~~~~~~~~~~~~~~~~
node_modules/mongoose/types/aggregate.d.ts:36:23 - error TS2694: Namespace '"C:/Users/servi/Desktop/d-drive/cctx/oba-express/node_modules/@types/mongodb/index"' has no exported member 'ExplainVerbosityLike'.
36 explain?: mongodb.ExplainVerbosityLike;
And 60 more...The build command output ends with this summary:
Found 63 errors in 11 files.
Errors Files
1 node_modules/connect-mongo/build/main/lib/MongoStore.d.ts:2
9 node_modules/mongoose/types/aggregate.d.ts:22
3 node_modules/mongoose/types/collection.d.ts:8
4 node_modules/mongoose/types/connection.d.ts:75
1 node_modules/mongoose/types/error.d.ts:37
1 node_modules/mongoose/types/index.d.ts:467
7 node_modules/mongoose/types/indexes.d.ts:18
26 node_modules/mongoose/types/models.d.ts:23
8 node_modules/mongoose/types/query.d.ts:103
2 node_modules/mongoose/types/schemaoptions.d.ts:43
1 node_modules/mongoose/types/session.d.ts:4
Expected behavior
Upon build, no errors generated. When this package is removed only, build runs perfectly as expected.