title: How can I check the type of an object in Typescript
body: <p>I'm trying to figure out whether my object is an instance of <code>interface Group</code> or <code>interface User</code>. Here is my code</p>
  <pre><code>interface Group {
      id: string,
      name: string
  }
  
  interface User {
      id: string,
      name: string,
      age: number,
      contact:number
  }
  </code></pre>
  <p>Now, when at some place when I try to filter out a list on the basis of instance type as</p>
  <pre><code>// rows is an array of mixed objects(Group &amp; User), I want to filter out Group objects
  rows=rows.filter((row:any)=&gt; {
              return row instanceof Employee;  // Here it gives the error... 
            });
  </code></pre>
  <p>It gives the error as</p>
  <blockquote>
  <p>'Employee' only refers to a type, but is being used as a value here.</p>
  </blockquote>
  <p><strong>Please, guide me how I can filter the list based on object type?</strong></p>