Re-export websocket types
IlyaSemenov opened this issue · comments
Ilya Semenov commented
Describe the feature
As a developer using websockets, I want to come up with generic helper functions working with websocket peers (such as for #715). However, h3
doesn't re-export the type of peer, so I have to use introspection types:
type Peer = Parameters<NonNullable<Parameters<typeof defineWebSocketHandler>[0]["open"]>>[0]
Not only this is cumbersome, but also it loses "genericness" of the original type.
I propose to re-export Peer
directly from h3
(and some other involved types, e.g. Message
, possibly others).
Additional information
- Would you be willing to help implement this feature?
Alexander Lichter commented