title: "Type 'string | string[]' is not assignable to type 'string'
body: <p>I am using node + typescript and integrated swagger for API Calls. I have a following request in swagger</p>
  
  <blockquote>
    <p><a href="http://localhost:3033/employees/search/?username=test" rel="noreferrer">http://localhost:3033/employees/search/?username=test</a></p>
  </blockquote>
  
  <p><em>Here I want to find the records having username = test.</em> </p>
  
  <p>So I parse the query string using URL module, like below and I am getting the username in my console.</p>
  
  <pre><code>var params = URL.parse(req.url, true).query;
  console.log(params); //gives me [Object: null prototype] { username: 'test' } in my console
  </code></pre>
  
  <p>But whenever I try to assign params.username to a constant like below</p>
  
  <pre><code>const username:string =params.username;
  </code></pre>
  
  <p>It gives me the following error</p>
  
  <blockquote>
    <p>Type 'string | string[]' is not assignable to type 'string'.
      Type 'string[]' is not assignable to type 'string'.</p>
  </blockquote>
  
  <p>My full code is as below</p>
  
  <pre><code>import * as URL from 'url';
  
  public getUserByName = async (req: Request, res: Response, next: NextFunction) =&gt; {
  var params = URL.parse(req.url, true).query;
  const username:string =params.username;
  
  try {
    const findOneUserData: Employee = await this.userService.findUserByName(username);
    res.status(200).json({ data: findOneUserData, message: 'findOne' });
  } catch (error) {
    next(error);
  }
  </code></pre>
  
  <p>}</p>