Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
### What? Make it possible to pass `headers()` where the `Headers` type is expected. An example would be `fetch`: ```ts import { headers } from "next/headers" // ... fetch("https://example.com", { headers: headers() }) ``` ### Why? `ReadonlyHeaders` _currently omits_ some mutating methods which make sense since they don't make sense. 🙃. However, it makes it necessary to pass the result anywhere where `Headers` is expected. Since we already throw errors when these methods are called illegally, we can make the type constraint a bit looser to avoid `as any` or `Object.fromEntries(headers())` or similar. ### How? Mark the unavailable methods as `@deprecated` which will visually mark them in IDEs: ![image](https://user-images.githubusercontent.com/18369201/235621140-3df8b10a-b90f-4ec3-b218-066303bfbc73.png) Closes NEXT-1075
- Loading branch information