title: Dynamic import based on environment variable
body: <p>In a project I have a environment varible which should be used to specifiy wheter we would like to use HTTPS or not:</p>
  <pre><code>SSL_ENABLED=1
  </code></pre>
  <p>Based on this environment variables I am now trying to use the https or http module:</p>
  <pre><code>import * as http from parseInt(process.env.SSL_ENABLED || '', 10) ? 'https' : 'http'
  
  const server = http.createServer(...)
  </code></pre>
  <p>The import above throws the following typescript error:</p>
  <pre><code>TS1141: String literal expected.
  </code></pre>
  <p>Of course I could work around this, importing both https and http separately, but I wanted to know if there was a way of fixing the above with a single import?</p>
  <p>Without typescript the following works just fine:</p>
  <pre><code>const http = require('http' + parseInt(process.env.SSL_ENABLED || '', 10) ? 's' : ''))
  </code></pre>