workerd icon indicating copy to clipboard operation
workerd copied to clipboard

Minor regression in types params names with `4.20240903.0`

Open Cherry opened this issue 1 year ago • 5 comments

Diff: https://npmdiff.dev/@cloudflare%2fworkers-types/4.20240821.1/4.20240903.0/package/experimental/index.ts Raw diff: https://github.com/Cloudflare-Mining/Cloudflare-Datamining/commit/66e958488df276e1d052cdb93e13b365e20fbd22#diff-498f7d22754cd92e5654b3be0adcae3df0c297abe440099d42dbc8cf43af66fd

FixedLengthStream previously had named paramaters:

declare class FixedLengthStream extends IdentityTransformStream {
  constructor(
    expectedLength: number | bigint,
    queuingStrategy?: IdentityTransformStreamQueuingStrategy,
  );
}

Now these are more generic with just param1 and param2:

declare class FixedLengthStream extends IdentityTransformStream {
  constructor(
    param1: number | bigint,
    param2?: IdentityTransformStreamQueuingStrategy,
  );
}

A few more methods/classes had the same thing occur including:

  • URL.canParse
  • URL.parse
  • IdentityTransformStreamQueuingStrategy
  • URLSearchParams
  • URLSearchParams.append
  • URLSearchParams.delete
  • URLSearchParams.get
  • URLSearchParams.getAll
  • URLSearchParams.has
  • URLSearchParams.set

Cherry avatar Sep 04 '24 12:09 Cherry

@jasnell Any idea what caused this regression?

anonrig avatar Sep 04 '24 15:09 anonrig

@jasnell @anonrig have the implementations for streams or URLs moved? We generate parameter names by parsing the c++ AST so it's relatively sensitive to refactoring

penalosa avatar Sep 04 '24 15:09 penalosa

The last change seems to be clang-format https://github.com/cloudflare/workerd/commits/main/src/workerd/jsg/url.c%2B%2B

anonrig avatar Sep 04 '24 15:09 anonrig

No changes that I'm aware of that would cause this. Really odd. Could the formatting changes have broken the ast transform?

jasnell avatar Sep 04 '24 16:09 jasnell

@penalosa ... I think we should first rule out a regression in the type generation logic. If that points to a change on the runtime side, then we'll investigate further but there really hasn't been much here that could have changed as far as I know.

jasnell avatar Sep 04 '24 18:09 jasnell

It looks like this was partially resolved in the latest update:

https://npmdiff.dev/@cloudflare%2fworkers-types/4.20240909.0/4.20240919.0/package/experimental/index.ts

FixedLengthStream has the correct param names again, as well as IdentityTransformStream, but not any of the others yet.

Cherry avatar Sep 19 '24 22:09 Cherry