Cannot use connect-pg-simple with express-session

19 Views Asked by At

I am trying to implement connect-pg-simple with express-session in typescript, but I keep getting errors regarding types. I have installed @types/connect-pg-simple and connect-pg-simple. What are my options here? Am I missing something or are the types not defined correctly?

Property 'cookie' is missing in type 'import(.../node_modules/@types/express-session/index").SessionData' but required in type 'Express.SessionData'.'

My connection looks like this:

import pgSession from 'connect-pg-simple';
const pgStore = pgSession(session);
const sessionStore = new pgStore({
  conString: process.env.DATABASE_NAME,
});

Edit: forgot to add my use of express-session:

app.use(
    session({
      name: 'usrSid',
      secret: process.env.SESSION_SECRET,
      saveUninitialized: false,
      resave: false,
      store: sessionStore, // error here
      cookie: {
        maxAge: 1000 * 60 * 60 * 12,
      },
    })
  );
0

There are 0 best solutions below