diff --git a/lib/index.ts b/lib/index.ts index ea05298b10..19825dd96e 100644 --- a/lib/index.ts +++ b/lib/index.ts @@ -709,3 +709,5 @@ emitterMethods.forEach(function(fn) { module.exports = (srv?, opts?) => new Server(srv, opts); module.exports.Server = Server; + +export { Socket }; // for "connect" event typing diff --git a/test/socket.io.ts b/test/socket.io.ts index 4dc69ef777..34b78eba77 100644 --- a/test/socket.io.ts +++ b/test/socket.io.ts @@ -1,6 +1,6 @@ "use strict"; -import { Server } from ".."; +import { Server, Socket } from ".."; import { createServer } from "http"; import fs = require("fs"); import { join } from "path"; @@ -357,7 +357,7 @@ describe("socket.io", () => { const sio = new Server(srv); srv.listen(() => { const socket = client(srv); - sio.on("connection", socket => { + sio.on("connection", (socket: Socket) => { expect(socket).to.be.a(Socket); done(); });