79ef1d69ac
### 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 |
||
---|---|---|
.. | ||
create-next-app | ||
eslint-config-next | ||
eslint-plugin-next | ||
font | ||
next | ||
next-bundle-analyzer | ||
next-codemod | ||
next-env | ||
next-mdx | ||
next-plugin-storybook | ||
next-polyfill-module | ||
next-polyfill-nomodule | ||
next-swc | ||
react-dev-overlay | ||
react-refresh-utils |