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
After this change TypeScript doesn't recognize my events without arguments anymore and throws an error when I start my socket.
To Reproduce
Socket.IO server version: 4.7.3
Server
// This is not my actual code, but my code to reproduce my issueimportexpressfrom'express';importhttpfrom'http';import{Namespace,Server}from'socket.io';constapp=express();constserver=http.createServer(app);constio=newServer(server);app.get('/',(_,res)=>{res.send('<h1>Hello world</h1><script src="https://cdn.socket.io/4.7.3/socket.io.min.js"></script><script>var socket = io(); socket.on(\'test\', () => {console.log(\'test triggered\');});</script>');});declarenamespaceSocketServer{interfaceClientEvents{['test']: ()=>void;['with-args']: (arg: string)=>void;['with-args-two']: (arg: string)=>void;}}constnamespace: Namespace<SocketServer.ClientEvents>=io.of('/server');namespace.on('connection',()=>{console.log('a user connected');namespace.emit('test');});server.listen(3000,()=>{console.log('listening on *:3000');});
Client
Don't have one for my reproduction code and already in the HTML sent when the app is connected.
Expected behavior
For the event to get recognized by TypeScript even though no arguments were provided and for it to compile without any issues.
Platform:
Device: Desktop
OS: Windows 10
The text was updated successfully, but these errors were encountered:
Describe the bug
After this change TypeScript doesn't recognize my events without arguments anymore and throws an error when I start my socket.
To Reproduce
Socket.IO server version:
4.7.3
Server
Client
Don't have one for my reproduction code and already in the HTML sent when the app is connected.
Expected behavior
For the event to get recognized by TypeScript even though no arguments were provided and for it to compile without any issues.
Platform:
The text was updated successfully, but these errors were encountered: