Namespace 'Express' has no exported member 'SessionData'

It appears the SessionData interface was removed from the global Express namespace, at the former line 24 on October 13, and recently published in the corresponding DefinitelyTyped modules -

Lots of discussion here -

I suspect this will be eventually be updated in the connect-mongo code at some point, but in the meantime you can work around it with the skipLibCheck flag mentioned by @benhu, or, if you want to leave that feature on for other libraries, you can add the interface back in within your own code somewhere with something like this:

// WORKAROUND TODO: Remove when the connect-mongo types are updated
declare global {
  namespace Express {
    interface SessionData {
      cookie: any

I reverted back to this version to fix the issue: "@types/express-session": "1.15.16",

For the connect-mongo lib type check, try to add skipLibCheck option to your tsconfig.json

  "compilerOptions": {
    "skipLibCheck": true

For the inline code, try to add // @ts-ignore

// @ts-ignore
req.session.user = user;

Please note that it is just a workaround, I have encountered same issue today when I try to rebuild the docker image on the DockerHub without any code changed.