title: Not a function error on TypeScript object after Casting
body: <p>I made an http call using Angular5 http client. In map function I have done the casting of the response to a PersonModel.</p>
  
  <p>PersonModel has a function getFullName() which returns first_name + last_name</p>
  
  <p>After doing the casting when I try to access this method on casted person object this shows an error of getFullName is not a function.</p>
  
  <pre><code>export class PersonModel {
  constructor(
                  public first_name: string = null,
                  public middle_name: string = null,
                  public last_name: string = null) {
  
      }
  
  getFullName() {
          return this.first_name + this.last_name;
      }
  
  }
  </code></pre>
  
  <p><strong>This is the service</strong></p>
  
  <pre><code>get(id: number): Observable&lt;PersonModel&gt; {
              return this.http.get("customer/" + id)
                  .map((response: any) =&gt; {
                      return &lt;PersonModel&gt;response;
                  });
          }
  
  
  customerService.get(1).subscribe(result =&gt; {
      console.log(result.getFullName());
  })
  </code></pre>
  
  <p><strong>Error</strong>
  core.js:1350 ERROR TypeError: person.getFullName is not a function</p>
  
  <p><strong>Log for object:</strong></p>
  
  <pre><code>{first_name: "kjlkj", last_name: "jnkjh"}
  </code></pre>
  
  <p>However when I create an object like this:</p>
  
  <pre><code>const person = new PersonModel();
  person.first_name = "lkj";
  person.last_name= "lkj";
  </code></pre>
  
  <p>then this logs as this:</p>
  
  <pre><code>PersonModel {first_name: "kjlkj", last_name: "jnkjh"}
  </code></pre>