title: Argument of type '{ host: string | undefined; user: string | undefined ... }' is not assignable to parameter of type 'string | ConnectionConfig'
body: <p>I'm creating a connection to an AWS mysql database like so:</p>
  <pre><code>const config = {
    host: process.env.RDS_HOSTNAME,
    user: process.env.RDS_USERNAME,
    password: process.env.RDS_PASSWORD,
    port: 3306,
    database: process.env.RDS_DB_NAME,
  }
  
  const db = mysql.createConnection(config) // config gets highlighted
  </code></pre>
  <p>But I get the following error:</p>
  <pre><code>Argument of type '{ host: string | undefined; user: string | undefined; password: string | undefined; port: number; database: string | undefined; }' is not assignable to parameter of type 'string | ConnectionConfig'.
  
  Type '{ host: string | undefined; user: string | undefined; password: string | undefined; port: number; database: string | undefined; }' is not assignable to type 'ConnectionConfig'.
  
      Types of property 'host' are incompatible.
        Type 'string | undefined' is not assignable to type 'string'.
          Type 'undefined' is not assignable to type 'string'.ts(2345)
  </code></pre>
  <p>Earlier on, I had a problem with the port coming from <code>.env</code>. When I switched to hardcoding the port, I get this.</p>
  <p>I don't understand what the problem is nor how to solve it.</p>