Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

URL getters (etc.) now returning ArrayBufferView and not string #1818

Closed
Cherry opened this issue Mar 12, 2024 · 0 comments · Fixed by #1820
Closed

URL getters (etc.) now returning ArrayBufferView and not string #1818

Cherry opened this issue Mar 12, 2024 · 0 comments · Fixed by #1820
Assignees
Labels
types Related to @cloudflare/workers-types

Comments

@Cherry
Copy link
Contributor

Cherry commented Mar 12, 2024

In the latest workers-types release, some return types are being typed as ArrayBufferView instead of string, such as the getters on URL objects.

Reference: https://npmdiff.dev/@cloudflare%2fworkers-types/4.20240222.0/4.20240312.0/package/2023-07-01/index.d.ts/
Or full source diff: Cloudflare-Mining/Cloudflare-Datamining@f3eb65c
image

Previously worked:

export default {
	async fetch(request: Request, env: Env, ctx: ExecutionContext): Promise<Response> {
		const url = new URL(request.url);
		const urlWithHostname = url.hostname + url.pathname;
		return new Response(urlWithHostname);
	},
};

Now it errors with:
Operator '+' cannot be applied to types 'ArrayBufferView' and 'ArrayBufferView'.ts(2365)

This also impacts getters on URLSearchParams. I would guess these unintentional changes are due to some of the changes with ada url implementation, but I'm not confident.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
types Related to @cloudflare/workers-types
Projects
None yet
2 participants