title: Immutable List and Typescript proper way to define an array of objects with type
body: <p>Here is my JSON data which i get from the server</p>
  
  <pre><code>[
    {
      "property1": 1,
      "property2": "asd",
      "property3": 2
    },
    {
      "property1": 1,
      "property2": "asd",
      "property3": 2
    },
    {
      "property1": 1,
      "property2": "asd",
      "property3": 2
    }
  
  ]
  </code></pre>
  
  <p>I want to define Immutable List object which uses this <code>interface</code></p>
  
  <pre><code>export interface myObject {
      propert1: number,
      propert2: string,
      propert3: number
  }
  </code></pre>
  
  <p>I tried something like this but its not working :</p>
  
  <pre><code>private myObjectList: Immutable.List&lt;myObject&gt; = Immutable.List([]);
  </code></pre>
  
  <p>and then using <code>angular $http</code></p>
  
  <pre><code>$http.get('my url to the json').then(function(data){
     this.myObjectList = data.data;
  });
  </code></pre>
  
  <p>But then <code>myObjectList variable</code> is exactly the same as the json, instead I want to keep the Immutable List Object and somehow push the data in it with my specific Type.
  In other words if the JSON objects are not exactly as the <code>interface</code> <code>myObject</code>, it should return an error</p>
  
  <p>I also Tried this but then i get typescript error</p>
  
  <pre><code>$http.get('my url to the json').then(function(data){
     this.myObjectList = Immutable.List(data.data);
  });
  
  error: Type 'List&lt;{}&gt;' is not assignable to type 'List&lt;Queries&gt;'
  </code></pre>