Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Latest version overwrites MongoDB types affecting other packages, i.e. connect-mongo #502

Open
onebrother21 opened this issue Aug 10, 2022 · 2 comments
Labels
bug A feature or code that is not working properly

Comments

@onebrother21
Copy link

onebrother21 commented Aug 10, 2022

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.

@onebrother21 onebrother21 added the bug A feature or code that is not working properly label Aug 10, 2022
@devconcept
Copy link
Owner

I guess hardcoding the version of the types "@types/mongodb": "^3.5.25" is a problem. Will fix it soon

@onebrother21
Copy link
Author

Just checking in on progress. Any ETA?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug A feature or code that is not working properly
Projects
None yet
Development

No branches or pull requests

2 participants