uNetworking / uWebSockets.js

μWebSockets for Node.js back-ends :metal:
Apache License 2.0
7.86k stars 569 forks source link

Update TypeScript definitions #719

Closed DarkMatterMatt closed 1 year ago

DarkMatterMatt commented 2 years ago

Hi there 👋

Breaking changes:

Non-breaking changes:


Two related notes

  1. At the moment closeOnBackpressureLimit and sendPingsAutomatically are Int32Value in AppWrapper.h, should these be BooleanValue?
  2. At the moment the native types have compatible interfaces which means that us_socket_context_t or any object can be used in places that only accept a us_listen_socket. I think that you could do something like this to avoid that happening:
    export interface us_listen_socket extends us_socket {
    _us_listen_socket: never;
    }
    export interface us_socket {
    _us_socket: never;
    }
    export interface us_socket_context_t {
    _us_socket_context_t: never;
    }

    This isn't perfect (as users could attempt to use listenToken._us_listen_socket), but imo it's an improvement. Do you think this something worth raising an issue for?