title: Conditional import to switch implementations
body: <p>I have node.js application written in TypeScript and I need to switch between two interface implementations based on the config file. Currently I have this code which seems to be working.</p>
  
  <pre><code>"use strict";
  
  import { config } from "../config";
  
  let Something;
  if (config.useFakeSomething) {
      Something = require("./FakeSomething").FakeSomething;
  } else {
      Something = require("./RealSomething").RealSomething;
  }
  ...
  let s = new Something();
  s.DoStuff();
  ...
  </code></pre>
  
  <p>But I have bad gut feeling about that (mainly because of the mixing <strong>require</strong> and <strong>import</strong> for loading modules). Is there some other way how to achieve implementation switching based on config file without importing both modules?</p>