Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion npm/workers-types/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,15 @@ The Cloudflare Workers runtime manages backwards compatibility through the use o

- `@cloudflare/workers-types/2022-11-30`

This entrypoint exposes the runtime types for a compatibility date after `2022-11-30`.
This entrypoint exposes the runtime types for a compatibility date between `2022-11-30` and `2023-03-01`.

- `@cloudflare/workers-types/2023-03-01`

This entrypoint exposes the runtime types for a compatibility date between `2023-03-01` and `2023-07-01`.

- `@cloudflare/workers-types/2023-07-01`

This entrypoint exposes the runtime types for a compatibility date after `2023-07-01`.

- `@cloudflare/workers-types/experimental`

Expand Down
24 changes: 18 additions & 6 deletions src/workerd/api/url-standard.h
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ class URLSearchParams: public jsg::Object {

inline uint getSize() { return list.size(); }

JSG_RESOURCE_TYPE(URLSearchParams) {
JSG_RESOURCE_TYPE(URLSearchParams, CompatibilityFlags::Reader flags) {
JSG_READONLY_PROTOTYPE_PROPERTY(size, getSize);
JSG_METHOD(append);
JSG_METHOD_NAMED(delete, delete_);
Expand All @@ -139,12 +139,24 @@ class URLSearchParams: public jsg::Object {
JSG_METHOD(toString);
JSG_ITERABLE(entries);

JSG_TS_OVERRIDE(URLSearchParams {
entries(): IterableIterator<[key: string, value: string]>;
[Symbol.iterator](): IterableIterator<[key: string, value: string]>;
if (flags.getUrlSearchParamsDeleteHasValueArg()) {
JSG_TS_OVERRIDE(URLSearchParams {
entries(): IterableIterator<[key: string, value: string]>;
[Symbol.iterator](): IterableIterator<[key: string, value: string]>;

forEach<This = unknown>(callback: (this: This, value: string, key: string, parent: URLSearchParams) => void, thisArg?: This): void;
});
forEach<This = unknown>(callback: (this: This, value: string, key: string, parent: URLSearchParams) => void, thisArg?: This): void;
});
} else {
JSG_TS_OVERRIDE(URLSearchParams {
delete(name: string): void;
has(name: string): boolean;

entries(): IterableIterator<[key: string, value: string]>;
[Symbol.iterator](): IterableIterator<[key: string, value: string]>;

forEach<This = unknown>(callback: (this: This, value: string, key: string, parent: URLSearchParams) => void, thisArg?: This): void;
});
}
// Rename from urlURLSearchParams
}

Expand Down
4 changes: 4 additions & 0 deletions src/workerd/tools/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,10 @@ compat_dates = [
# https://developers.cloudflare.com/workers/platform/compatibility-dates/#streams-constructors
# https://developers.cloudflare.com/workers/platform/compatibility-dates/#compliant-transformstream-constructor
("2022-11-30", "2022-11-30"),
# https://github.com/cloudflare/workerd/blob/fcb6f33d10c71975cb2ce68dbf1924a1eeadbd8a/src/workerd/io/compatibility-date.capnp#L275-L280 (http_headers_getsetcookie)
("2023-03-01", "2023-03-01"),
# https://github.com/cloudflare/workerd/blob/fcb6f33d10c71975cb2ce68dbf1924a1eeadbd8a/src/workerd/io/compatibility-date.capnp#L307-L312 (urlsearchparams_delete_has_value_arg)
("2023-07-01", "2023-07-01"),
# Latest compatibility date (note these types should be the same as the previous entry)
(None, "experimental"),
]
Expand Down