Property 'session' does not exist on type 'IncomingMessage'.ts(2339) any #5173
Unanswered
Anand-Keshavan
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I get the above error when I try to use the express-session example ( typescript) in the documentation. Here is the code:
`declare module "express-session" {
interface SessionData {
}
const sessionMiddleware = session({
secret: "losgatos",
resave: true,
saveUninitialized: true,
});
const app = express();
app.use(sessionMiddleware);
const httpServer = createServer(app);
const io = new Server(httpServer, { /* options */ });
io.engine.use(sessionMiddleware);
o.on("connection", (socket) => {
const sessionId = socket.request.session.id. // <---- error here
...
`
package versions:
"@types/express": "^4.17.21", "@types/express-session": "^1.18.0", "express": "^4.19.2", "express-session": "^1.18.0", "socket.io": "^4.7.5",
Beta Was this translation helpful? Give feedback.
All reactions