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
import{io,Socket}from"socket.io-client";interfaceCliToServ{frdRequest:(user:{userId:string})=>void;}interfaceServToCli{
hello:()=>void;}constsocket:Socket<ServToCli,CliToServ>=io("ws://localhost:3000/",{});socket.on("connect",()=>{console.log(`connect ${socket.id}`);});socket.on("disconnect",()=>{console.log("disconnect");});//this is where it falsely shows the errtry{constres=awaitsocket.emitWithAck("frdRequest",{userId:"1234"})}catch{//err handling here}//it says I passed 2 arguments and it //expected 1//To resolve this I had to pass a second//unwanted prop to the interface ieinterfaceCliToServ{frdRequest:(user:{userId:string},x:unknown)=>void;}//with the above the err doesn't show ///and still it doesn't infer that useless //prop
Expected behavior
With valid type definition it had not to make any warnings, and there was no need for me to add an unwanted prop
Platform:
Device: [Dell Latitude]
OS: [windows 10]
Additional context
That unwanted prop added it's also not inferred on emittion
The text was updated successfully, but these errors were encountered:
Describe the bug
After defining types for the socket instance, the compiler is inferring the arguments wrongly in CLI lib
To Reproduce
Please fill the following code example:
Socket.IO server version:
4.8.1
Server
Socket.IO client version:
4.8.1
Client
Expected behavior
With valid type definition it had not to make any warnings, and there was no need for me to add an unwanted prop
Platform:
Additional context
That unwanted prop added it's also not inferred on emittion
The text was updated successfully, but these errors were encountered: