title: Simpler way to use array of class
body: <p>I have a class and then defined an array of class, each time that I want to add a node to array, I have to mention the class name that I don't like it:</p>
  
  <pre><code>export class ItemModel {
    constructor(
      ID,
      Name
    ) {
      this.ID = ID;
      this.Name = Name; 
    }
  }
  
  export var ItemsArray = [];
  
  ItemsArray.push(new ItemModel(0, "BreakFast"));
  ItemsArray.push(new ItemModel(1, "Lunch"));
  ItemsArray.push(new ItemModel(2, "Dinner"));
  </code></pre>
  
  <p>After reading this post:</p>
  
  <p><a href="https://answers.unity.com/questions/637902/how-to-use-javascript-array-with-classes.html" rel="nofollow noreferrer">https://answers.unity.com/questions/637902/how-to-use-javascript-array-with-classes.html</a></p>
  
  <p>I tried to declare the class at the time that I define the array like this:</p>
  
  <pre><code>var ItemsArray : ItemModel[];
  </code></pre>
  
  <p>but I get error : "Types Can only be used in .ts files.</p>
  
  <p>I searched google for that but none of them was helpful.</p>
  
  <p>Any recommendation would be appreciated.</p>