We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
socket.data
I was working with socket.data and noticed that I couldn't define its types. I tried to search the same issue here, but didn't find
socket.data<User>
new Server<{user: User}>(server, { cors: { origin: * }, })
socket.data = user
socket.data: {User, ...any}
Right now I can create a subclass to use it:
interface SocketDataType = { user: User } export declare class ExtendedSocketServer<ListenEvents extends EventsMap = DefaultEventsMap, EmitEvents extends EventsMap = ListenEvents, ServerSideEvents extends EventsMap = DefaultEventsMap, SocketDataType = any> extends Server<ListenEvents, EmitEvents, ServerSideEvents> { of(name: string | RegExp | ParentNspNameMatchFn, fn?: (socket: ExtendedSocketServer<ListenEvents, EmitEvents, ServerSideEvents, SocketDataType>) => void): Namespace<ListenEvents, EmitEvents, ServerSideEvents>; }
Also, I can use the patch-package. I just modified the original node_modules/socket.io/dist/socket.d.ts and run yarn patch-package
patch-package
node_modules/socket.io/dist/socket.d.ts
yarn patch-package
The text was updated successfully, but these errors were encountered:
That sounds reasonable 👍 would you have time to open a pull request for this?
Sorry, something went wrong.
Socket.data
Successfully merging a pull request may close this issue.
Is your feature request related to a problem? Please describe.
I was working with
socket.data
and noticed that I couldn't define its types. I tried to search the same issue here, but didn't findDescribe the solution you'd like
socket.data<User>
socket.data = user
thensocket.data
becomessocket.data: {User, ...any}
or something like thisDescribe alternatives you've considered
Right now I can create a subclass to use it:
Additional context
Also, I can use the
patch-package
. I just modified the originalnode_modules/socket.io/dist/socket.d.ts
and runyarn patch-package
The text was updated successfully, but these errors were encountered: