<p dir="auto">Hi,</p>
<p dir="auto"><strong>TypeScript Version:</strong> 1.8.5<br>
<strong>Visual Studio</strong> 2013</p>
<div class="highlight highlight-source-ts notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="interface Foo { a: string }
interface Bar { b: string }

getData&lt;T&gt;(): T {
   return null;
}

var funcArray = [this.getData&lt;Foo&gt;(), this.getData&lt;Bar&gt;()];  //Inferred as (Foo | Bar)[]"><pre class="notranslate"><span class="pl-k">interface</span> <span class="pl-smi">Foo</span> <span class="pl-kos">{</span> <span class="pl-c1">a</span>: <span class="pl-smi">string</span> <span class="pl-kos">}</span>
<span class="pl-k">interface</span> <span class="pl-smi">Bar</span> <span class="pl-kos">{</span> <span class="pl-c1">b</span>: <span class="pl-smi">string</span> <span class="pl-kos">}</span>

<span class="pl-s1">getData</span><span class="pl-c1">&lt;</span><span class="pl-smi">T</span><span class="pl-c1">&gt;</span><span class="pl-kos">(</span><span class="pl-kos">)</span>: <span class="pl-smi">T</span> <span class="pl-kos">{</span>
   <span class="pl-k">return</span> <span class="pl-c1">null</span><span class="pl-kos">;</span>
<span class="pl-kos">}</span>

<span class="pl-k">var</span> <span class="pl-s1">funcArray</span> <span class="pl-c1">=</span> <span class="pl-kos">[</span><span class="pl-smi">this</span><span class="pl-kos">.</span><span class="pl-en">getData</span><span class="pl-kos">&lt;</span><span class="pl-smi">Foo</span><span class="pl-kos">&gt;</span><span class="pl-kos">(</span><span class="pl-kos">)</span><span class="pl-kos">,</span> <span class="pl-smi">this</span><span class="pl-kos">.</span><span class="pl-en">getData</span><span class="pl-kos">&lt;</span><span class="pl-smi">Bar</span><span class="pl-kos">&gt;</span><span class="pl-kos">(</span><span class="pl-kos">)</span><span class="pl-kos">]</span><span class="pl-kos">;</span>  <span class="pl-c">//Inferred as (Foo | Bar)[]</span></pre></div>
<p dir="auto">Shouldn't this be inferred as <code class="notranslate">[Foo, Bar]</code>?<br>
Is this intended behavior? Looks reasonable since <code class="notranslate">funcArray</code> can be explicitly typed to <code class="notranslate">[Foo, Bar]</code></p>
<p dir="auto">PS: This could be a duplicate of other issues for contextual typing, which is/are already fixed (fix included in milestone 2.0?)</p>
<p dir="auto">I have been looking at dependency injection and a few issues with refactoring in regards to <code class="notranslate">_.pluck</code>.  One of the primary things I run into is that I want these things to enforce the interface for refactoring.</p>
<p dir="auto">A few examples</p>
<p dir="auto">Interface used as a symbol for dependency injection</p>
<div class="highlight highlight-source-ts notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="interface IExampleInterface {
  interfaceProperty: string;
}

function angularInjection(...fields: string[]) {
  return (target: Function) {
    target.$inject = fields;
  }
}

@angularInjection(nameof(IExampleInterface));
class Controller {
  constructor(injectedExample: IExampleInterface) {
  }
}"><pre class="notranslate"><span class="pl-k">interface</span> <span class="pl-smi">IExampleInterface</span> <span class="pl-kos">{</span>
  <span class="pl-c1">interfaceProperty</span>: <span class="pl-smi">string</span><span class="pl-kos">;</span>
<span class="pl-kos">}</span>

<span class="pl-k">function</span> <span class="pl-en">angularInjection</span><span class="pl-kos">(</span>...<span class="pl-s1">fields</span>: <span class="pl-smi">string</span><span class="pl-kos">[</span><span class="pl-kos">]</span><span class="pl-kos">)</span> <span class="pl-kos">{</span>
  <span class="pl-k">return</span> <span class="pl-kos">(</span><span class="pl-s1">target</span>: <span class="pl-smi">Function</span><span class="pl-kos">)</span><span class="pl-kos"></span> <span class="pl-kos">{</span>
    <span class="pl-s1">target</span><span class="pl-kos">.</span><span class="pl-c1">$inject</span> <span class="pl-c1">=</span> <span class="pl-s1">fields</span><span class="pl-kos">;</span>
  <span class="pl-kos">}</span>
<span class="pl-kos">}</span>

@<span class="pl-en">angularInjection</span><span class="pl-kos">(</span><span class="pl-en">nameof</span><span class="pl-kos">(</span><span class="pl-smi">IExampleInterface</span><span class="pl-kos">)</span><span class="pl-kos">)</span><span class="pl-kos">;</span>
<span class="pl-k">class</span> <span class="pl-smi">Controller</span> <span class="pl-kos">{</span>
  <span class="pl-en">constructor</span><span class="pl-kos">(</span><span class="pl-s1">injectedExample</span>: <span class="pl-smi">IExampleInterface</span><span class="pl-kos">)</span> <span class="pl-kos">{</span>
  <span class="pl-kos">}</span>
<span class="pl-kos">}</span></pre></div>
<p dir="auto">would compile to</p>
<div class="highlight highlight-source-js notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="function angularInjection() {
    var fields = [];
    for (var _i = 0; _i &lt; arguments.length; _i++) {
        fields[_i - 0] = arguments[_i];
    }
    return function (target) {
        target.$inject = fields;
    };
}
var Controller = (function () {
    function Controller(injectedExample) {
    }
    Controller = __decorate([
        angularInjection('IExampleInterface')
    ], Controller);
    return Controller;
})();"><pre class="notranslate"><span class="pl-k">function</span> <span class="pl-en">angularInjection</span><span class="pl-kos">(</span><span class="pl-kos">)</span> <span class="pl-kos">{</span>
    <span class="pl-k">var</span> <span class="pl-s1">fields</span> <span class="pl-c1">=</span> <span class="pl-kos">[</span><span class="pl-kos">]</span><span class="pl-kos">;</span>
    <span class="pl-k">for</span> <span class="pl-kos">(</span><span class="pl-k">var</span> <span class="pl-s1">_i</span> <span class="pl-c1">=</span> <span class="pl-c1">0</span><span class="pl-kos">;</span> <span class="pl-s1">_i</span> <span class="pl-c1">&lt;</span> <span class="pl-smi">arguments</span><span class="pl-kos">.</span><span class="pl-c1">length</span><span class="pl-kos">;</span> <span class="pl-s1">_i</span><span class="pl-c1">++</span><span class="pl-kos">)</span> <span class="pl-kos">{</span>
        <span class="pl-s1">fields</span><span class="pl-kos">[</span><span class="pl-s1">_i</span> <span class="pl-c1">-</span> <span class="pl-c1">0</span><span class="pl-kos">]</span> <span class="pl-c1">=</span> <span class="pl-smi">arguments</span><span class="pl-kos">[</span><span class="pl-s1">_i</span><span class="pl-kos">]</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">target</span><span class="pl-kos">)</span> <span class="pl-kos">{</span>
        <span class="pl-s1">target</span><span class="pl-kos">.</span><span class="pl-c1">$inject</span> <span class="pl-c1">=</span> <span class="pl-s1">fields</span><span class="pl-kos">;</span>
    <span class="pl-kos">}</span><span class="pl-kos">;</span>
<span class="pl-kos">}</span>
<span class="pl-k">var</span> <span class="pl-v">Controller</span> <span class="pl-c1">=</span> <span class="pl-kos">(</span><span class="pl-k">function</span> <span class="pl-kos">(</span><span class="pl-kos">)</span> <span class="pl-kos">{</span>
    <span class="pl-k">function</span> <span class="pl-v">Controller</span><span class="pl-kos">(</span><span class="pl-s1">injectedExample</span><span class="pl-kos">)</span> <span class="pl-kos">{</span>
    <span class="pl-kos">}</span>
    <span class="pl-v">Controller</span> <span class="pl-c1">=</span> <span class="pl-en">__decorate</span><span class="pl-kos">(</span><span class="pl-kos">[</span>
        <span class="pl-en">angularInjection</span><span class="pl-kos">(</span><span class="pl-s">'IExampleInterface'</span><span class="pl-kos">)</span>
    <span class="pl-kos">]</span><span class="pl-kos">,</span> <span class="pl-v">Controller</span><span class="pl-kos">)</span><span class="pl-kos">;</span>
    <span class="pl-k">return</span> <span class="pl-v">Controller</span><span class="pl-kos">;</span>
<span class="pl-kos">}</span><span class="pl-kos">)</span><span class="pl-kos">(</span><span class="pl-kos">)</span><span class="pl-kos">;</span></pre></div>
<p dir="auto">In the case of an interface like pluck we could do something like this</p>
<div class="highlight highlight-source-ts notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="interface IExampleInterface {
  prop: string;
}

var items: IExampleInterface[] = [{prop: 'test1'},{prop: 'test1'}];
var props: string[] = _.pluck(items, nameof(IExampleInterface.prop));"><pre class="notranslate"><span class="pl-k">interface</span> <span class="pl-smi">IExampleInterface</span> <span class="pl-kos">{</span>
  <span class="pl-c1">prop</span>: <span class="pl-smi">string</span><span class="pl-kos">;</span>
<span class="pl-kos">}</span>

<span class="pl-k">var</span> <span class="pl-s1">items</span>: <span class="pl-smi">IExampleInterface</span><span class="pl-kos">[</span><span class="pl-kos">]</span> <span class="pl-c1">=</span> <span class="pl-kos">[</span><span class="pl-kos">{</span><span class="pl-c1">prop</span>: <span class="pl-s">'test1'</span><span class="pl-kos">}</span><span class="pl-kos">,</span><span class="pl-kos">{</span><span class="pl-c1">prop</span>: <span class="pl-s">'test1'</span><span class="pl-kos">}</span><span class="pl-kos">]</span><span class="pl-kos">;</span>
<span class="pl-k">var</span> <span class="pl-s1">props</span>: <span class="pl-smi">string</span><span class="pl-kos">[</span><span class="pl-kos">]</span> <span class="pl-c1">=</span> <span class="pl-s1">_</span><span class="pl-kos">.</span><span class="pl-en">pluck</span><span class="pl-kos">(</span><span class="pl-s1">items</span><span class="pl-kos">,</span> <span class="pl-en">nameof</span><span class="pl-kos">(</span><span class="pl-smi">IExampleInterface</span><span class="pl-kos">.</span><span class="pl-c1">prop</span><span class="pl-kos">)</span><span class="pl-kos">)</span><span class="pl-kos">;</span></pre></div>
<p dir="auto">would compile to</p>
<div class="highlight highlight-source-js notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="var items = [{prop: 'test1'}, {prop: 'test1'}];
var props = _.pluck(items, 'prop');"><pre class="notranslate"><span class="pl-k">var</span> <span class="pl-s1">items</span> <span class="pl-c1">=</span> <span class="pl-kos">[</span><span class="pl-kos">{</span><span class="pl-c1">prop</span>: <span class="pl-s">'test1'</span><span class="pl-kos">}</span><span class="pl-kos">,</span> <span class="pl-kos">{</span><span class="pl-c1">prop</span>: <span class="pl-s">'test1'</span><span class="pl-kos">}</span><span class="pl-kos">]</span><span class="pl-kos">;</span>
<span class="pl-k">var</span> <span class="pl-s1">props</span> <span class="pl-c1">=</span> <span class="pl-s1">_</span><span class="pl-kos">.</span><span class="pl-en">pluck</span><span class="pl-kos">(</span><span class="pl-s1">items</span><span class="pl-kos">,</span> <span class="pl-s">'prop'</span><span class="pl-kos">)</span><span class="pl-kos">;</span></pre></div>
<p dir="auto">In this way we could enforce some level of type safety in common javascript reflection use cases.</p>