Closed
Description
Describe the bug
Calling io.emit("event") with events that either no argument result in TypeScript errors.
To Reproduce
Socket.IO server version: 4.7.3
Server
import { Server } from "socket.io";
interface ServerToClientEvents {
noArg: () => void;
}
const io = new Server<{}, ServerToClientEvents>();
io.emit("noArg"); // <- Error
Expected behavior
No errors
Actual behavior
Argument of type 'string' is not assignable to parameter of type 'never'. ts(2345)
Platform:
- Device: Lenovo IdeaPad 5 14ITL05
- OS: Windows 11 Home 23H2 (22631.2861)
Additional context
Seems to be a regression, after downgrading to 4.7.2 the error disappeared.