title: An alternative to `any` when doing type safe data fetching with SWR?
body: <p>The React data fetching library SWR has an example using the library with typescript <a href="https://github.com/vercel/swr/tree/master/examples/basic-typescript" rel="nofollow noreferrer">here</a>. In the example, a fetcher function is <a href="https://github.com/vercel/swr/blob/master/examples/basic-typescript/libs/fetch.ts" rel="nofollow noreferrer">defined</a> that wraps fetch and which is then passed to the <code>useSWR</code> hook to do the actual data fetching.</p>
  <pre><code>export default async function fetcher&lt;JSON = any&gt;(
    input: RequestInfo,
    init?: RequestInit
  ): Promise&lt;JSON&gt; {
    const res = await fetch(input, init)
    return res.json()
  }
  </code></pre>
  <p>While not immediately clear from the repo, this results in an typescript-eslint warning due to an <a href="https://github.com/typescript-eslint/typescript-eslint/blob/v4.30.0/packages/eslint-plugin/docs/rules/no-explicit-any.md" rel="nofollow noreferrer">unexpected any</a>. Below is a screen shot from my editor showing the warning:</p>
  <p><a href="https://i.stack.imgur.com/UVT95.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/UVT95.png" alt="Eslint warning from my local setup" /></a></p>
  <p>I'm a little unclear as to what's the correct way to handle the <code>any</code> type here? Should I replace it with <code>unknown</code>? Or should I define a custom type?</p>