title: Using getInitialProps in Next.js with TypeScript
body: <p>From the documentation, Next.js 5.0 announcement and various articles around on the internet it seems like Next.js supports TypeScript well and many people are using it.</p>
  
  <p>But these threads suggest that <code>getInitialProps</code>, which is vital to Next.js apps, doesn't work:</p>
  
  <ul>
  <li><a href="https://github.com/zeit/next.js/issues/3396" rel="noreferrer">https://github.com/zeit/next.js/issues/3396</a></li>
  <li><a href="https://github.com/zeit/next.js/issues/1651" rel="noreferrer">https://github.com/zeit/next.js/issues/1651</a></li>
  <li><a href="https://github.com/DefinitelyTyped/DefinitelyTyped/issues/23356" rel="noreferrer">https://github.com/DefinitelyTyped/DefinitelyTyped/issues/23356</a></li>
  </ul>
  
  <p>How can I fix it? In both class and functional components, when I do <code>ComponentName.getInitialProps = async function() {...}</code> I get the following error:</p>
  
  <pre><code>[ts] Property 'getInitialProps' does not exist on type '({ data }: { data: any; }) =&gt; Element'.
  </code></pre>