I was just wondering if it is possible to type array with a union type, so that one array can contain both Apples and Oranges but nothing else.
Something like
var arr : (Apple|Orange)[] = [];
arr.push(apple); //ok
arr.push(orange); //ok
arr.push(1); //error
arr.push("abc"); // error
Needless to say, the example above does not work so this may not be possible, or am I missing something?