Skip to content

types: Response is no longer compatible with ResponseInit #2765

@jahands

Description

@jahands

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 :(

Metadata

Metadata

Labels

typesRelated to @cloudflare/workers-types

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions