title: Using open-ended params in TS with classes
body: <p>In the following example, I'm expecting the length of the array passed to the method <code>test</code> to match.
  Can anyone explain why it doesn't work as expected?</p>
  <pre><code>class Beef
  {
      public id: number;
  }
  
  class Steak
  {
      public run()
      {
          const testBeefs = this.getBeef();
          console.log('Should be 5, got '+ testBeefs.length);
          
          const result = this.test(testBeefs);
  
          return result;
      }
      
      private getBeef():Beef[]
      {
          const output: Beef[] = [];
          for (var i = 1; i &lt;= 5; i++)
          {
              const newBeef = new Beef();
              newBeef.id = i;
              output.push(newBeef);
          }
          return output;
      }
  
      private test(...beefs: Beef[]): number
      {
          console.log('Should be 5, got '+ beefs.length);
          
          var output = 0;
          for (var i = 0; i &lt; beefs.length; i++)
              output += beefs[i].id;
            
          return output;
      }
  }
  </code></pre>
  <p>According to the compiler it seems that <code>test</code> is expecting and instance of <code>Beef</code>, not <code>Beef[]</code>. Is there a simpler way?</p>
  <p>Example <a href="https://www.typescriptlang.org/play?#code/FDDGBsEMGdoAgEIFMkDNgG9hx3ADgK4BG4AlqHKQCYBccAdgQLZFIBOA3MAL4gQzwAygBckkANaZsuQiXJw2BegAoAlNJxZc2uKAD29aMLiijyNPAC8JgBaloAOgDmSYedRquO3PsN7wSA7gek7KAOSCNnoE4FRwrHAArAA0cE56xmEA1CZIZiiojgH0TsI2ql7ecBo6vkYKeTHG1mX2DqbCyh3u0BUgVQ3CBGz0DdBNlTi82jV4bKQAbpCiaa7uajTuANoAujVaVXXG0cKEwnTbO3DWu5M6qHpscMpLT6TXcACMHJRwADzWRI-UhZLLqAYHAY4I4MJAAd3cH3o8MQBU8NQGyIRBQc1A+pDuAxOZwchGgNmUWPcfQG0yqbFcw1GxIIwjuvFm8yWKw6ygc-NYFguBV2qjojBY7H2GJ8Bmg-kCwVCESiMTiCRSaQycGy8QKRSQJTKNKqMpwrzgLOacAADITcA8ni9IG8Pnbfn89RYgobSjZgaDwVUAJBWuBZayCwpbUg7XFUe0zAYMoYjS2ss7snh8OXGIxicRIlEiAvosByhVBELKfMSByKFSqCpAA" rel="nofollow noreferrer">here</a></p>
  <p>To explain my code, calling run will:</p>
  <ol>
  <li>Create an array via <code>getBeef</code> with 5 instances of the class <code>Beef</code> called <code>testBeefs</code></li>
  <li>Pass <code>testBeefs</code> to the method <code>test</code></li>
  <li><code>test</code> will sum the <code>id</code> field of each <code>Beef</code> instance</li>
  </ol>