title: Nextjs how to type Error page with typescript
body: <p>How can type an nextjs Error page with Typescript</p>
  <p>I've tried with:</p>
  <pre><code>interface ErrorProps {
    statusCode: number;
  }
  function Error({ statusCode }: ErrorProps) {
    return (
      &lt;p&gt;
        {statusCode
          ? `An error ${statusCode} occurred on server`
          : &quot;An error occurred on client&quot;}
      &lt;/p&gt;
    );
  }
  
  interface InitialProps {
    res: NextApiResponse;
    err: NextApiResponse;
  }
  Error.getInitialProps = ({ res, err }: InitialProps) =&gt; {
    const statusCode = res ? res.statusCode : err ? err.statusCode : 404;
    return { statusCode };
  };
  </code></pre>
  <p>but not sure it's the right way</p>