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

types: Response is no longer compatible with ResponseInit #2765

Closed
jahands opened this issue Sep 21, 2024 · 3 comments · Fixed by #2781
Closed

types: Response is no longer compatible with ResponseInit #2765

jahands opened this issue Sep 21, 2024 · 3 comments · Fixed by #2781
Assignees
Labels
types Related to @cloudflare/workers-types

Comments

@jahands
Copy link

jahands commented Sep 21, 2024

After updating workers-types from 4.20240909.0 to 4.20240919.0, a response can no longer use another response as the ResponseInit.

Example:

const res1 = new Response('', { headers: { foo: 'bar' } })
const newRes = new Response('hello', res1)

I've used this for ages to inherit headers/etc, as well as make a response mutable.

This also breaks Hono where a common pattern is to do something like this:

const res = await fetch(url)
return c.body(res.body, res)

I had to add ts-ignore's to 12 of my Workers to get around this issue :(

@jahands jahands added the types Related to @cloudflare/workers-types label Sep 21, 2024
@kentonv
Copy link
Member

kentonv commented Sep 23, 2024

Presumably broken by #2738? @anonrig

@anonrig
Copy link
Member

anonrig commented Sep 23, 2024

It should be fixed by #2755. It seems the latest release doesn't include it yet.

@kentonv
Copy link
Member

kentonv commented Sep 23, 2024

@anonrig No, I think this is a separate bug.

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
Development

Successfully merging a pull request may close this issue.

4 participants