reactiverse / es4x

🚀 fast JavaScript 4 Eclipse Vert.x
https://reactiverse.io/es4x/
Apache License 2.0
878 stars 75 forks source link

Signature of WebClientSession in @vertx/web-client needs updating #522

Open outloudvi opened 3 years ago

outloudvi commented 3 years ago

As reported by tsc:

Class static side 'typeof WebClientSession' incorrectly extends base class static side 'typeof WebClient'.
  Types of property 'create' are incompatible.
    Type '(webClient: WebClient) => WebClientSession' is not assignable to type '{ (vertx: Vertx): WebClient; (vertx: Vertx, options: WebClientOptions): WebClient; }'.
      Types of parameters 'webClient' and 'vertx' are incompatible.
        Type 'Vertx' is missing the following properties from type 'WebClient': request, requestAbs, get, getAbs, and 10 more.

The code seems to build and work after I modified the following function signature in index.d.ts:

static create(webClient: WebClient) : WebClientSession;

to

static create(webClient: Vertx) : WebClientSession;
pmlopes commented 3 years ago

This is one of the limitations of vertx-codegen that needs manual patching. Thanks for reporting it!

The overload is tricky in this case, because it overlaps with a parent API interface... but it can be done with a override json