title: object is set but property returns undefined
body: <p>I have created a class as below:</p>
  <pre><code>export class User{
      private _name:string
  
      User(){}
  
      get name():string{
          return this._name
      }
  
      set name(val:string){
          this._name = val
      }
  
  }
  </code></pre>
  <p>now in my code at login i am fetching data from server side and assigning it to a variable as below:</p>
  <pre><code>import { Injectable } from '@angular/core';
  import { User } from './modal/user.modal';
  
  @Injectable({
    providedIn: 'root'
  })
  export class CoreService {
    user:User
  
    constructor() { }
  }
  </code></pre>
  <p>login.ts</p>
  <pre><code> this.core.user = await this.dataSvc.fetchCustomer(resp.user.uid)
        console.log(&quot;user is:&quot;, Object.keys(this.core.user))
        console.log(&quot;user is:&quot;, Object.values(this.core.user))
  
        console.log(&quot;user is:&quot;, this.core.user)
        console.log(&quot;user name is:&quot;, this.core.user.name)
  </code></pre>
  <p>Below is the response and the last line of printing name undefined is something i am not able to figure out</p>
  <pre><code>user is: 
  Array(5) [ &quot;_email&quot;, &quot;_joinDate&quot;, &quot;_name&quot;, &quot;_phone&quot;, &quot;_uid&quot; ]
  main.js:469:17
  user is: 
  Array(5) [ &quot;vik.ceo@gmail.com&quot;, 1658372252068, &quot;Vivek Kumar&quot;, &quot;6508670697&quot;, &quot;AoaFKbEzrYcjZUE283rI4dpSYh92&quot; ]
  main.js:470:17
  user is: 
  Object { _email: &quot;vik.ceo@gmail.com&quot;, _joinDate: 1658372252068, _name: &quot;Vivek Kumar&quot;, _phone: &quot;6508670697&quot;, _uid: &quot;AoaFKbEzrYcjZUE283rI4dpSYh92&quot; }
  main.js:471:17
  user name is: undefined
  </code></pre>