Describe the bug
emitWithAck doesn't seem to be picking up types correctly, so the type variable Ev is assigned never.
To Reproduce
Socket.IO server version: 4.8.1
Server
import { Server } from "socket.io";
interface ServerToClientEvents {
someEvent: (callback: (err: Error) => void) => void;
}
interface ClientToServerEvents {}
const io = new Server<ClientToServerEvents, ServerToClientEvents>();
io.on("connection", async (socket) => {
// Typescript gives error "Argument of type 'string' is not assignable to parameter of type 'never'.ts(2345)"
await socket.emitWithAck("someEvent");
// No error
socket.emit("someEvent", (err) => {});
});
Client
No client code necessary.
Expected behavior
No Typescript error (similar to emit behavior)
Platform:
- Device: Macbook Air M2
- OS: MacOS Sonoma 14.6.1
Additional context
Seems to be the same bug as mentioned in the comment #4925 (comment), but different from that issue.
Describe the bug
emitWithAckdoesn't seem to be picking up types correctly, so the type variableEvis assignednever.To Reproduce
Socket.IO server version:
4.8.1Server
Client
No client code necessary.
Expected behavior
No Typescript error (similar to
emitbehavior)Platform:
Additional context
Seems to be the same bug as mentioned in the comment #4925 (comment), but different from that issue.