title: How to cast req.query parameters in Express using Typescript
body: <p>I'm running an express.js application using TypeScript. Every time I try to process <code>request.query.foo</code> I get the following error:</p>
  <pre><code>Argument of type 'string | ParsedQs | string[] | ParsedQs[] | undefined' is not assignable to parameter of type 'string'.
  </code></pre>
  <p>Setup:</p>
  <pre><code>import { Request, Response } from 'express';
  
  function bar(request: Request, response: Response) {
    const foo: string = request.query.foo; //marked as error
  }
  </code></pre>
  <p>I read on the documentation of Express that you can set a configuration called &quot;query parser&quot; that when set to &quot;simple&quot; will always parse the query parameters as a string</p>
  <p>The problem is that Typescript still thinks that something other than string or undefined may come and I can't seem to find a way to override the Request interface, I can only extend it.</p>
  <p>Is there any way to override the Request interface? is there something wrong in my approach?</p>