How can I get the type of the reponse object? #4105
-
Hi, I am using socket.io-client with TypeScript and I am using acknowledgements when emitting a message: socket.emit("update item", "1", { name: "updated" }, (response) => {
console.log(response.status);
}); (from the doc) But I have the following error in TS:
How can I type the response object? Where can I find it? The type of I want to be able to get the status or the error field. Thanks! |
Beta Was this translation helpful? Give feedback.
Answered by
darrachequesne
Sep 24, 2021
Replies: 1 comment 2 replies
-
Hi! Please check this: https://socket.io/docs/v4/migrating-from-3-x-to-4-0/#typed-events I'll update the documentation with a more complete example. |
Beta Was this translation helpful? Give feedback.
2 replies
Answer selected by
johhnry
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hi! Please check this: https://socket.io/docs/v4/migrating-from-3-x-to-4-0/#typed-events
I'll update the documentation with a more complete example.