title: Type casting issue in Observable in Angular 8
body: <p>Hi I am learning Angular 8 and as a learner I have many doubts. I am sharing one of my doubts in detail. I hope some of you can easily help and correct me.</p>
  
  <p>I have a service which consumes to Web API and returns some company details like</p>
  
  <pre><code>0: {CompanyId: 1, Name: "xxxx", Address: "bn"}
  1: {CompanyId: 2, Name: "yyyy", Address: "tv"}
  </code></pre>
  
  <p>service.ts</p>
  
  <pre><code>GetAll(): Observable&lt;IEmployee&gt;{
  return this.httpClient.get&lt;IEmployee&gt;(this.apiUrl + "GetCompany_test").}
  </code></pre>
  
  <p>component.ts</p>
  
  <pre><code>private emp : IEmployee;
  
  getAllEmployees(){
   this.service.GetAll().subscribe(
    response =&gt; {this.emp =response;console.log(response)},
    error =&gt; console.log(error)
    );}
  </code></pre>
  
  <p>IEmployee.ts</p>
  
  <pre><code>export interface IEmployee{
  fullName:string,
  Email:string,
  Mobile:string,
  City:string,
  HireDate:Date
  }
  </code></pre>
  
  <p>I get the company details even though I use Observable of <code>Observable&lt;IEmployee&gt;</code>. So what is the need of casting here? and when I cast to Employee and I easily get non Employee data,it should so me some warning or error in the console right? I am totally confused about what is happening. </p>
  
  <p>Can somebody please help me to understand the concept of casting here and advice me to correctly use casting.</p>
  
  <p>Regards.</p>