Cannot redeclare block-scoped variable
<p>I have node program which ultimately uses commonjs and therefore my JS files start with a number of <strong>require</strong> statements. I renamed these JS files to TS with the hope that I could incrementally move into Typescript but am getting these errors:</p>

<p><a href="https://i.stack.imgur.com/wwXOn.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/wwXOn.png" alt="enter image description here"></a></p>

<p>from the following code:</p>

<pre><code>const RSVP = require('rsvp');
const moment = require('moment');
const firebase = require('universal-firebase');
const email = require('universal-sendgrid');
const sms = require('universal-twilio');
const merge = require('merge');
const typeOf = require('type-of');
const promising = require('promising-help');
const _ = require('lodash');

const up = require('./upload');
const audience = require('./audiences');
const message = require('./messages');
</code></pre>

<p>The locally referenced modules like <code>upload</code>, <code>audiences</code>, and <code>messages</code> <em>are</em> likely to define most (all?) of the same modules such <code>lodash</code>, etc. I'm guessing that somehow the namespace scope is not being respected between modules but I'm not sure why.</p>

<p>I'm also unclear whether using ES6 <code>import</code> syntax would properly transpile to a ES5 <strong>commonjs</strong> "require" module format (this is using Node 0.10.x).</p>

<p>Oh as additional context, my <code>tsconfig.json</code> is:</p>

<pre><code>{
  "compilerOptions": {
    "target": "es5",
    "module": "commonjs",
    "removeComments": true,
    "sourceMap": true,
    "outDir": "./dist",
    "watch": true
  },
  "compileOnSave": true
}
</code></pre>

<blockquote>
  <p>Note: I've seen other people have gotten the <em>"cannot redeclare block-scoped variable"</em> error before but none of the conversations seemed to really fully fit my situation. Although i'm quite new to Typescript so maybe I'm making a newbie mistake.</p>
</blockquote>

<hr>

<p>Also of note, I noticed some examples of a strange variant of commonjs and ecmascript module formats:</p>

<pre><code>import up = require('./upload');
</code></pre>

<p>This is in contrast to how I'd normally write it as:</p>

<pre><code>const up = require('./upload');
</code></pre>

<p>When I use the "import" keyword, however, it complains that <code>upload.ts</code> is not a module:</p>

<p><a href="https://i.stack.imgur.com/52uxQ.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/52uxQ.png" alt="not a module"></a></p>