title: typescript generic type guard
body: <p>I have variable that can be either of type <code>C1[]</code> or <code>C2&lt;C1&gt;[]</code> how do I create a type guard  for the variable?</p>
  
  <pre><code>interface C&lt;T&gt;{
     key: string;
     secret: T;
  }
  
  private isC(d: Foo[] | C&lt;Foo&gt;): d is C&lt;Foo&gt;[] {
      return (&lt;C&lt;Foo&gt;&gt;)d[0].key !== undefined
  }
  </code></pre>
  
  <p>The method <code>isC</code> is not compiling.</p>