feature: Make typings in decorators from socket Server: ListenEvents, EmitEvents... #888
Labels
flag: needs discussion
Issues which needs discussion before implementation.
type: feature
Issues related to new features.
Description
I am migrating to socket-controllers from an existing socket.io installation, which is using typings for messages, parameters, and socket data (I don't use ServerEvents yet).
This looks like this:
Then it allows to have type checks for message names, parameters:
When migrating to socket-controllers, I have not found how to retrieve that, for example:
@OnMessage('...')
: Should typecheck"joinGame"
@MessageAck() ack
: Type should be(joined: true | string) => void
I could find a workaround for the first case by doing something like:
But it is trickier for
@MessageAck()
!Proposed solution
Not sure at all, but when we do:
Probably there is a way to retrieve all Server types and put them to decorators, or maybe add generics to
new SocketControllers<ListenEvents, EmitEvents, ...>()
same as when doingnew Server<...>()
.The text was updated successfully, but these errors were encountered: