<p dir="auto"><strong>TypeScript Version:</strong></p>
<p dir="auto">1.8.7</p>
<p dir="auto"><strong>Code</strong></p>
<div class="highlight highlight-source-ts notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="computeFunctionFromDBFieldName = (): any =&gt; {
if (this.dbFieldName) {
                return function(object: any): string {
                    return argJsonObject[this.dbFieldName];
...
}"><pre class="notranslate"><span class="pl-s1">computeFunctionFromDBFieldName</span> <span class="pl-c1">=</span> <span class="pl-kos">(</span><span class="pl-kos">)</span>: <span class="pl-smi">any</span> <span class="pl-c1">=&gt;</span> <span class="pl-kos">{</span>
<span class="pl-k">if</span> <span class="pl-kos">(</span><span class="pl-smi">this</span><span class="pl-kos">.</span><span class="pl-c1">dbFieldName</span><span class="pl-kos">)</span> <span class="pl-kos">{</span>
                <span class="pl-k">return</span> <span class="pl-k">function</span><span class="pl-kos">(</span><span class="pl-s1">object</span>: <span class="pl-smi">any</span><span class="pl-kos">)</span>: <span class="pl-smi">string</span> <span class="pl-kos">{</span>
                    <span class="pl-k">return</span> <span class="pl-s1">argJsonObject</span><span class="pl-kos">[</span><span class="pl-smi">this</span><span class="pl-kos">.</span><span class="pl-c1">dbFieldName</span><span class="pl-kos">]</span><span class="pl-kos">;</span>
...
<span class="pl-kos">}</span></pre></div>
<p dir="auto"><strong>Expected behavior:</strong></p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content=" this.computeFunctionFromDBFieldName = function () {
                if (_this.dbFieldName) {             
                        return function (argJsonObject) {
                            return argJsonObject[_this.dbFieldName];
                        };"><pre class="notranslate"><code class="notranslate"> this.computeFunctionFromDBFieldName = function () {
                if (_this.dbFieldName) {             
                        return function (argJsonObject) {
                            return argJsonObject[_this.dbFieldName];
                        };
</code></pre></div>
<p dir="auto"><strong>Actual behavior:</strong><br>
Generated js</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content=" this.computeFunctionFromDBFieldName = function () {
                if (_this.dbFieldName) {             
                        return function (argJsonObject) {
                            return argJsonObject[this.dbFieldName];
                        };"><pre class="notranslate"><code class="notranslate"> this.computeFunctionFromDBFieldName = function () {
                if (_this.dbFieldName) {             
                        return function (argJsonObject) {
                            return argJsonObject[this.dbFieldName];
                        };
</code></pre></div>
<p dir="auto">The expected difference would be that the _this would also be in the array referencing.</p>
<p dir="auto">Hi,</p>
<p dir="auto">I just updated the typescript compiler from 1.0.1.0 to 1.1.0.1.</p>
<p dir="auto">Then when I using the Webstorm Typescript Transpiling, it keeps reporting TS2300: Duplicate identifier.<br>
I investigate a bit, it seems like the references is the problem.</p>
<p dir="auto">In our current project, we include all the .ts files and external library .d.ts files in one references.d.ts file and include a single references.d.ts file for each .ts file we coded.<br>
This reference mechanism works just fine on tsc 1.0.1.0</p>
<p dir="auto">But on 1.1.0.1, it seems like it can not do self reference any more. Then I try to make specific reference for each .ts file. However it still get some TS2300: Duplicate identifier in some classes when the dependencies depend on another same dependency. It seems like it will reference the same dependency twice to cause Duplicate identifier error.</p>
<p dir="auto">eg:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="A.ts:
/// &lt;reference path=&quot;D.ts&quot; /&gt;

B.ts:
/// &lt;reference path=&quot;D.ts&quot; /&gt;

C.ts:
/// &lt;reference path=&quot;A.ts&quot; /&gt;
/// &lt;reference path=&quot;B.ts&quot; /&gt;"><pre class="notranslate"><code class="notranslate">A.ts:
/// &lt;reference path="D.ts" /&gt;

B.ts:
/// &lt;reference path="D.ts" /&gt;

C.ts:
/// &lt;reference path="A.ts" /&gt;
/// &lt;reference path="B.ts" /&gt;
</code></pre></div>
<p dir="auto">Because I am using AngularJS framework, so it is quite common that A and B are services to inject D service, C as controller to inject A and B services.</p>
<p dir="auto">In this scenario, typescript compiler report TS2300: Duplicate identifier 'D' when it compile C.ts</p>
<p dir="auto">PS: I know this references issue will not occurs in VS since it has some 'magic' implicant reference mechanism to reference all the .ts/ .d.ts files. I hope it is not the Webstorm issue, because it seems like compile issue more or less.</p>
<p dir="auto">Also, it will be great if there is some standard Typescript coding style to do the proper dependencies reference when people are using Webstorm or other IDE than VS. Maybe some auto fixing dependencies reference as plugin would be better.</p>