Skip to content

Commit 0141951

Browse files
refactor(types): ensure compatibility with Express middlewares
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
1 parent 8b22162 commit 0141951

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

lib/server.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -320,7 +320,7 @@ export abstract class BaseServer extends EventEmitter {
320320
*
321321
* @param fn
322322
*/
323-
public use(fn: Middleware) {
323+
public use(fn: any) {
324324
this.middlewares.push(fn);
325325
}
326326

0 commit comments

Comments
 (0)