function foo (x: $Either,U>): Array { return []; } var x1:number = foo(0)[0]; var x2:string = foo([""])[0];