title: How to extend globalThis/global type?
body: <p>I'm working on a typescript project with <a href="https://www.prisma.io/" rel="nofollow noreferrer">Prisma</a> and I saw this code on <a href="https://vercel.com/guides/nextjs-prisma-postgres#step-3.-install-and-generate-prisma-client" rel="nofollow noreferrer">this guide</a> that is using typescript. However my linter gives me errors for the following code.</p>
  <pre class="lang-js prettyprint-override"><code>import { PrismaClient } from '@prisma/client';
  
  let prisma: PrismaClient;
  
  if (process.env.NODE_ENV === 'production') {
    prisma = new PrismaClient();
  } else {
    if (!global.prisma) {
      global.prisma = new PrismaClient();
    }
    prisma = global.prisma;
  }
  
  export default prisma;
  </code></pre>
  <p>The error message for lines 8,9,11 (for <code>global.prisma</code>) is the following</p>
  <blockquote>
  <p>Element implicitly has an 'any' type because type 'typeof globalThis' has no index signature. ts(7017)</p>
  </blockquote>
  <p>How can I extend the type of globalThis or global with <code>Prismaclient</code> so that it works as intended?</p>