Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

socket.io-client typescript error#4224

Answeredbydarrachequesne
gwendalF asked this question inQ&A
Discussion options

Hello, I am starting a new project with socketio-client. I use the version 4.4.0 but I have troubles with Typescript. When I try to usesocket.on('event') I get the following error:
My socket was create by the following:
export const socket = io('http://localhost:5000');

Property 'on' does not exist on type 'Socket<DefaultEventsMap, DefaultEventsMap>'.ts(2339)

How can I do to be able to use the on function on my socket? I tried the Typescript definition but it did not change anything.

Thanks

You must be logged in to vote

Hi! That's weird, are you able to reliably reproduce? Could you please check with the examplethere?

See also:https://socket.io/docs/v4/typescript/

Replies: 3 comments

Comment options

Hi! That's weird, are you able to reliably reproduce? Could you please check with the examplethere?

See also:https://socket.io/docs/v4/typescript/

You must be logged in to vote
0 replies
Answer selected bygwendalF
Comment options

Hello,
It may have been a cache issue. I cannot reproduce the error and the example working fine
Thanks

You must be logged in to vote
0 replies
Comment options

I am hitting the same issue.

You must be logged in to vote
0 replies
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Category
Q&A
Labels
None yet
3 participants
@gwendalF@darrachequesne@anthonyalayo

[8]ページ先頭

©2009-2025 Movatter.jp