es4x icon indicating copy to clipboard operation
es4x copied to clipboard

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

Open outloudvi opened this issue 4 years ago • 1 comments

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;

outloudvi avatar Apr 19 '21 12:04 outloudvi

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

pmlopes avatar Apr 19 '21 12:04 pmlopes