Skip to content

Deprecated @types/mongodb package causes error #554

@kaihaase

Description

@kaihaase

Describe the bug
multer-gridfs-storage uses the deprecated @types/mongodb package as a dependency. There are conflicts with the mongodb package in version >= 5:

node_modules/multer-gridfs-storage/node_modules/@types/mongodb/index.d.ts:58:74 - error TS2724: '"bson"' has no exported member named 'ObjectID'. Did you mean 'ObjectId'?

58 export { Binary, DBRef, Decimal128, Double, Int32, Long, MaxKey, MinKey, ObjectID, ObjectId, Timestamp } from "bson";
                                                                            ~~~~~~~~

  node_modules/bson/bson.d.ts:918:22
    918 export declare class ObjectId extends BSONValue {
                             ~~~~~~~~
    'ObjectId' is declared here.


Found 1 error in node_modules/multer-gridfs-storage/node_modules/@types/mongodb/index.d.ts:58

Environment

  • I'm using multer-gridfs-storage package version 5.0.2 with mongodb package version 5.0.1

  • My installed MongoDb version is 6.0.1

  • I have Multer 1.4.5-lts.1 installed to upload files

  • The Node version used to run the code is 16.17.0

  • I'm using Mongoose connection objects to create storage instances. The Mongoose version installed is 6.9.1

To Reproduce
Integrate the above packages into any project and try to build the project.

Expected behavior
Since mongodb now comes with its own types, the deprecated @types/mongodb package can be dispensed with altogether.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugA feature or code that is not working properly

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions