You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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:
In order to prevent issues like:
> error TS2345: Argument of type 'RequestHandler<ParamsDictionary, any, any, ParsedQs, Record<string, any>>' is not assignable to parameter of type 'Middleware'.
> Types of parameters 'req' and 'req' are incompatible.
> Type 'IncomingMessage' is missing the following properties from type 'Request<ParamsDictionary, any, any, ParsedQs, Record<string, any>>': get, header, accepts, acceptsCharsets, and 29 more.
>
> io.engine.use(sessionMiddleware);
~~~~~~~~~~~~~~~~~
Related: socketio/socket.io#4644
We could also have use the RequestHandler type from the
@types/express-serve-static-core package, but that would add 5 new
dependencies.
See also: https://github.com/socketio/engine.io/issues/673
Describe the bug
In the How to use with
express-session
part of the docs, there's an example for4.6.0+
version of the library, that suggests to use express middleware withio.engine.use
, but typings seem to be off.io.engine.use
acceptsMiddleware
type, butexpress-session
middleware type isRequestHandler
. Both are middleware handlers but the request types diverge. It leads to this issue:To Reproduce
Socket.IO server version:
4.6.0
Server
Expected behavior
No TS errors. Types are compatible
Platform:
The text was updated successfully, but these errors were encountered: