TypeScript and Socket.io

前端 未结 4 2193
伪装坚强ぢ
伪装坚强ぢ 2021-02-04 15:08

I would like to use socket.io in my Typescript project, but I\'ve only found .d.ts files for server-side typescript.

This is a nice example: https://github.com/soywiz/ty

4条回答
  •  遇见更好的自我
    2021-02-04 15:50

    Inside @types/socket.io-client, you can find the following type which is best suited for clients:

    const client: SocketIOClient.Socket = io('http://localhost');
    

提交回复
热议问题