Typescript: How to map over union array type? : <p>I have the following structure:</p>

<pre><code>interface Test1 {
    number: number;
}
interface Test2 extends Test1 {
    text: string;
}

let test: Test1[] | Test2[] = [];
test.map(obj =&gt; {}); // does not work
</code></pre>

<p>I am getting the error:</p>

<blockquote>
  <p>Cannot invoke an expression whose type lacks a call signature. Type '{ (this: [Test1, Test1, Test1, Test1, Test1], callbackfn: (this: void, value: Test1, index: nu...' has no compatible call signatures</p>
</blockquote>

<p>How can I <code>map</code> over the test variable?</p>
