Skip to content

Commit

Permalink
Remove spec-compliant URLSearchParams if not enabled by compatibili…
Browse files Browse the repository at this point in the history
…ty flag
  • Loading branch information
penalosa committed Nov 28, 2024
1 parent 1650021 commit 6c7edac
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion src/workerd/api/url-standard.h
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,19 @@ class URLSearchParams: public jsg::Object {
JSG_METHOD(toString);
JSG_ITERABLE(entries);

if (flags.getUrlSearchParamsDeleteHasValueArg()) {
if (!flags.getSpecCompliantUrl()) {
// This is a hack. The spec-compliant URLSearchParams type is used in
// the Body constructor, see:
// https://github.com/balusch/workerd/tree/main/src/workerd/api/http.h#L255
// This means that when the TypeScript generation scripts are visiting root types for inclusion,
// we'll always visit the spec-compliant type even if we have the
// "url-standard" flag disabled. Rather than updating those usages based
// on which flags are enabled, we just delete the spec compliant
// declaration in an override if "url-standard" is disabled.
// We do the same for the non-spec-compliant URLSearchParams, see:
// https://github.com/balusch/workerd/tree/main/src/workerd/api/url.h#L219
JSG_TS_OVERRIDE(type URLSearchParams = never);
} else if (flags.getUrlSearchParamsDeleteHasValueArg()) {
JSG_TS_OVERRIDE(URLSearchParams {
entries(): IterableIterator<[key: string, value: string]>;
[Symbol.iterator](): IterableIterator<[key: string, value: string]>;
Expand Down

0 comments on commit 6c7edac

Please sign in to comment.