I'm dealing with a variable that can be either of type C1[]
or C2<C1>[]
. How can I create a type guard for this variable?
interface C<T>{
key: string;
secret: T;
}
private isC(d: Foo[] | C<Foo>): d is C<Foo>[] {
return (<C<Foo>>)d[0].key !== undefined
}
The function isC
is generating errors during compilation.