I'm having an error when using connect-mongo and mongodb typings in my project.
const database: mongodb.Db = client.db(config.dbName);
const storeOptions: connectMongo.NativeMongoOptions = {
db: database,
};
app.use(session({
...
store: new MongoStore(storeOptions),
}));
the storeOptions produces an error:
Type '{ db: Db; }' is not assignable to type 'NativeMongoOptions'.
Types of property 'db' are incompatible.
Type 'import("/node_modules/@types/mongodb/index").Db' is not assignable to type 'import("/node_modules/@types/connect-mongo/node_modul...'.
Property 'authenticate' is missing in type 'Db'.
As far as I understand, this is because I'm using @types/mongodb^3 and the latest @types/connect-mongo is using @types/mongodb^2.
@Syati
+1
And while we are at it, let's please also update @types/connect-mongo's mongoose to ^5.
Most helpful comment
+1
And while we are at it, let's please also update @types/connect-mongo's mongoose to ^5.