Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Re-export websocket types #716

@IlyaSemenov

Description

@IlyaSemenov

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?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions