title: Typescript - Conditional require
body: <p>One of the problems of <code>moment-timezone</code> is that it gives you a warning if you include it multiple times. I have a module that requires the timezone. Because I don't know if whoever is using will or will not set the timezone themself, I have the following:</p>
  
  <pre><code>if (moment.tz === undefined) {
      require('moment-timezone');
      moment.tz.setDefault('America/Los_Angeles');
  }
  </code></pre>
  
  <p>This works fine in normal Javascript. I recently was experimenting to switch to Typscript, and when I do this, I get the error that <code>Cannot find name 'require'</code>. </p>
  
  <p>I switched that line to <code>import momentTimezone = require('moment-timezone');</code> but then get <code>An import declaration can only be used in a namespace or module.</code></p>
  
  <p>What can I do? </p>