var x0: NonNullable<number|string> = 0; // ok, number ~> number|string
var x1: NonNullable<number|string> = true; // err, boolean ~> number|string
var x2: ({p:number, ...}|{p:string, ...})["p"] = 0; // ok, number ~> number|string
var x3: ({p:number, ...}|{p:string, ...})["p"] = true; // err, boolean ~> number|string

// annots
type P2 = T['p']; // NB: T is not resolved yet
declare const p2: P2;
0 as P2; // ok, number ~> string|number
null as P2; // err, null ~> string|number
type T = {p: string, ...} | {p: number, ...}; // NB: T resolved here

// Order
 type TupleUnion = [1] | [2];
{
  declare const x: [3];
  x as TupleUnion; // ERROR: 1, 2
  x as Readonly<TupleUnion>; // ERROR: 1, 2 (same order as above)
}
