error TS7016: Could not find a declaration file for module 'mongodb'
asierbayon opened this issue · comments
-
I'm submitting a ...
[x] bug report
[ ] feature request
[ ] question about the decisions made in the repository
[ ] question about how to use this project -
Summary
Express Typescript app crashes on build with the following error
node_modules/connect-mongo/build/main/lib/MongoStore.d.ts:2:83 - error TS7016: Could not find a declaration file for module 'mongodb'. '/mnt/c/Users/asier/dev/justlaunched/api/node_modules/mongodb/lib/mongodb/index.js' implicitly
has an 'any' type.
If the 'mongodb' package actually exposes this module, consider sending a pull request to amend 'https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/mongodb'
import { Collection, MongoClient, MongoClientOptions, WriteConcernSettings } from 'mongodb';
- Other information (e.g. detailed explanation, stack traces, related issues, suggestions how to fix, links for us to have context, eg. StackOverflow, personal fork, etc.)
import expressSession from 'express-session';
import MongoStore from 'connect-mongo';
const session = expressSession({
secret: process.env.SESSION_SECRET
saveUninitialized: false,
resave: false,
cookie: {
secure: (process.env.SESSION_SECURE && true) || false,
httpOnly: true,
maxAge: Number(process.env.SESSION_MAX_AGE) || 3600000
},
store: new MongoStore({
ttl: Number(process.env.SESSION_MAX_AGE) || 3600,
mongoUrl: process.env.MONGODB_URI || 'mongodb://127.0.0.1:27017/justlaunched',
mongoOptions: { useUnifiedTopology: true }
})
});
export default session;