Next.js Discord

Discord Forum

How to change `fetch` type in typescript? Trying to create a npm package for NextJS with fetch tags.

Cinnamon posted this in #help-forum
Open in Discord
I get this error:
Argument of type '{ next: { tags: string[]; }; }' is not assignable to parameter of type 'RequestInit'.
  Object literal may only specify known properties, and 'next' does not exist in type 'RequestInit'.ts(2345)

How could I modify the type of fetch to accomdoate NextJS fetch tags? This is in a separate package which will be imported in a NextJS project.

1 Reply

Could you simply extend the RequestInit with a CustomRequestInit for example?