title: Return type for Express routes with TypeScript
body: <p>I'm trying to use TypeScript to it's full potential, so I avoid <code>any</code> if possible.</p>
  
  <p>I've seen Express routes defined like this:</p>
  
  <pre><code>import { Request, Response } from "express";
  
  myRouter.route("/foo").post((req: Request, res: Response): Response =&gt; {
    return res.send("Hello World");
  });
  </code></pre>
  
  <p>That works because <code>send()</code> returns an express <code>Response</code>.</p>
  
  <p>But if I do a redirect:</p>
  
  <pre><code>myRouter.route("/bar").post((req: Request, res: Response): Response =&gt; {
    return res.redirect("/baz");         // redirect() returns void!
  });
  </code></pre>
  
  <p>That won't compile because <code>redirect()</code> returns void, not <code>Response</code>.</p>
  
  <p>Options:</p>
  
  <ul>
  <li>The easy fix is to make the route return <code>any</code>, but I want to avoid that if possible</li>
  <li>I've seen code that does <code>as unknown as Response</code> but that seems like a hack</li>
  </ul>
  
  <p>What is the correct way to declare routes' return types, without using <code>any</code>?</p>