title: get the type of input and cast it in Angular
body: <p>I am passing <code>@Input() element</code> variable to the <code>app-child</code> component</p>
  
  <pre><code>&lt;app-child [element]="element"&gt;&lt;/app-child&gt;
  </code></pre>
  
  <p><code>element</code> is an object. It can be of many types, lets say <code>Blue</code>, <code>Red</code> or <code>Green</code></p>
  
  <p>Inside <code>ChildComponent.ts</code>, how can I determine the type of  <code>element</code> and cast it to the correct type? <code>instanceof</code> cannot be used with variables of type <code>any</code>.</p>
  
  <pre><code>`ChildComponent.ts`
  
  @Input() element: any; // is it of type Blue, Red or Green?
  </code></pre>