title: Get the type of property of object in Angular
body: <p>I have class in Angular 6 </p>
  
  <pre><code>export class classXY{
    xValue: number;
    yValue: number;
    xDate: Date;
    yDate: Date;
    xName?: string;
    yName?: string;
  }
  </code></pre>
  
  <p>in my code, I need to check the properties that have type number.</p>
  
  <pre><code>let obj: ClassXY;
  obj.xValue=1;
  obj.yValue=null;
  obj.xDate= new Date();
  obj.yDate= null;
  obj.xName= "test";
  obj.yName= null;
  
      for (var key in obj) {
        if ((obj[key] == null) &amp;&amp; (typeof obj[key] === "number"))
          obj[key] = -1;
  }
  </code></pre>
  
  <p><strong>typeof obj["yValue"]</strong> value is null and <strong>typeof "yValue"</strong> is string, while I need to return the type of property number. Same for <strong>instanceof</strong></p>
  
  <p>How I check the primitive type of property of an object?</p>