Arrays and generic classes that extends another class: Possible in typescript?
<h2>I have an address book and two types of Contacts:</h2>

<ul>
<li>Persons</li>
<li>Organizations</li>
</ul>

<p>Both of them extends <strong>Contact</strong> class.</p>

<hr>

<p>I want a method of a class to <strong>return an array of contacts</strong>.</p>

<pre><code>public method(args...): Array&lt;Contact&gt; {...}
</code></pre>

<p>Nice, but what if i have that method to <strong>do something with some properties of the Contacts</strong> inside the array?</p>

<pre><code>public method(args...): Array&lt;Contact&gt; {
  contacts :Array&lt;Contact&gt; = getContactsFromSomewhere();
  contacts.forEach( contact =&gt; {
    if(typeof contact === "Person"){ //persons and organizations are different, they have different atrributes
      //Here i modify some Person attributes
    }
    else{
      //Here i modify some Organization attributes
  });
  return contacts;
</code></pre>

<p>This feels cumbersome, difficult to read. <strong>Why not something like this?</strong></p>

<pre><code>public method(args...): Array&lt;T extends Contact&gt; {
  contacts :Array&lt;T extends Contact&gt; = getContactsFromSomewhere();
  contacts.forEach( contact =&gt; {
    contact.doSomething() //abstract method implemented in both classes its own way.
  });
  return contacts;
</code></pre>

<p>Impossible, i <strong>can't do this</strong></p>

<pre><code>Array&lt;T extends Contact&gt;
</code></pre>

<p>This <strong>error</strong> is thrown by VSCode:</p>

<blockquote>
  <p>[ts] Generic type 'Array' requires 1 type argument(s)</p>
</blockquote>

<h2>Is possible working with an array that uses a generic class that extends another class in typescript?</h2>