<p dir="auto">I'm having an issue with duplicate identifier errors. It appears to stem from having the same definitions listed in multiple places.</p>
<p dir="auto">Let's say that I have a simple node server that utilizes the bluebird promise library. I have bluebird used in the main server code and in a library I wrote used by the server code. The structure looks like this:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="|-- server.ts
|-- tsd.json
|-- typings
|-- lib
    |-- mylib.ts
    |-- tsd.json
    |-- typings"><pre class="notranslate"><code class="notranslate">|-- server.ts
|-- tsd.json
|-- typings
|-- lib
    |-- mylib.ts
    |-- tsd.json
    |-- typings
</code></pre></div>
<p dir="auto">Here is the code for and for <code class="notranslate">mylib.ts</code>:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="/// &lt;reference path=&quot;./typings/tsd.d.ts&quot;/&gt;
import Promise = require('bluebird')
class MyLib {
}
export = MyLib"><pre class="notranslate"><code class="notranslate">/// &lt;reference path="./typings/tsd.d.ts"/&gt;
import Promise = require('bluebird')
class MyLib {
}
export = MyLib
</code></pre></div>
<p dir="auto">and  <code class="notranslate">server.ts</code>:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="/// &lt;reference path=&quot;./typings/tsd.d.ts&quot;/&gt;
import Promise = require('bluebird')
import MyLib = require('./lib/mylib')
class Server {
}
export = Server"><pre class="notranslate"><code class="notranslate">/// &lt;reference path="./typings/tsd.d.ts"/&gt;
import Promise = require('bluebird')
import MyLib = require('./lib/mylib')
class Server {
}
export = Server
</code></pre></div>
<p dir="auto">As you can see, both <code class="notranslate">server.ts</code> and <code class="notranslate">mylib.ts</code> use the bluebird library. Since <code class="notranslate">server.ts</code> uses <code class="notranslate">mylib.ts</code>, it ends up importing bluebird twice, which results in errors. So when I run</p>
<p dir="auto"><code class="notranslate">tsc server.ts --module commonjs</code></p>
<p dir="auto">I get</p>
<blockquote>
<p dir="auto">lib/typings/bluebird/bluebird.d.ts(705,9): error TS2300: Duplicate identifier 'concurrency'.<br>
lib/typings/bluebird/bluebird.d.ts(708,9): error TS2300: Duplicate identifier 'spread'.<br>
lib/typings/bluebird/bluebird.d.ts(711,9): error TS2300: Duplicate identifier 'suffix'.<br>
typings/bluebird/bluebird.d.ts(705,9): error TS2300: Duplicate identifier 'concurrency'.<br>
typings/bluebird/bluebird.d.ts(708,9): error TS2300: Duplicate identifier 'spread'.<br>
typings/bluebird/bluebird.d.ts(711,9): error TS2300: Duplicate identifier 'suffix'.</p>
</blockquote>
<p dir="auto">Tools like npm seem to be able to handle this situation. The only way I can get typescript to handle it is by having a single <code class="notranslate">tsd.json</code> file and corresponding <code class="notranslate">typings</code> folder at the root of my project and having all the typescript definitions live there. Is that the generally accepted way to structure things?</p>
<p dir="auto">This input results in one "Duplicate identifier" error on the second declaration. it would be helpful to have all of them flagged. this also applies to duplicate implementations incase of functions.</p>
<div class="highlight highlight-source-ts notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="interface I {
    a
}

interface I {
    a
}"><pre class="notranslate"><span class="pl-k">interface</span> <span class="pl-smi">I</span> <span class="pl-kos">{</span>
    <span class="pl-c1">a</span>
<span class="pl-kos">}</span>

<span class="pl-k">interface</span> <span class="pl-smi">I</span> <span class="pl-kos">{</span>
    <span class="pl-c1">a</span>
<span class="pl-kos">}</span></pre></div>