Skip to content

Typings issue with io.engine.use  #4644

@fastndead

Description

@fastndead

Describe the bug
In the How to use with express-session part of the docs, there's an example for 4.6.0+ version of the library, that suggests to use express middleware with io.engine.use, but typings seem to be off. io.engine.use accepts Middleware type, but express-session middleware type is RequestHandler. Both are middleware handlers but the request types diverge. It leads to this issue:
image

To Reproduce
Socket.IO server version: 4.6.0

Server

import session from "express-session";

const sessionMiddleware = session({
  secret: "changeit",
  resave: false,
  saveUninitialized: false
});

io.engine.use(sessionMiddleware);

Expected behavior
No TS errors. Types are compatible

Platform:

  • Device: MacBook
  • OS: MacOS

Metadata

Metadata

Assignees

No one assigned

    Labels

    to triageWaiting to be triaged by a member of the team

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions