463 lines
29 KiB
Plaintext
463 lines
29 KiB
Plaintext
=== tests/cases/compiler/arrayBestCommonTypes.ts ===
|
|
module EmptyTypes {
|
|
>EmptyTypes : Symbol(EmptyTypes, Decl(arrayBestCommonTypes.ts, 0, 0))
|
|
|
|
interface iface { }
|
|
>iface : Symbol(iface, Decl(arrayBestCommonTypes.ts, 0, 19))
|
|
|
|
class base implements iface { }
|
|
>base : Symbol(base, Decl(arrayBestCommonTypes.ts, 1, 23))
|
|
>iface : Symbol(iface, Decl(arrayBestCommonTypes.ts, 0, 19))
|
|
|
|
class base2 implements iface { }
|
|
>base2 : Symbol(base2, Decl(arrayBestCommonTypes.ts, 2, 35))
|
|
>iface : Symbol(iface, Decl(arrayBestCommonTypes.ts, 0, 19))
|
|
|
|
class derived extends base { }
|
|
>derived : Symbol(derived, Decl(arrayBestCommonTypes.ts, 3, 36))
|
|
>base : Symbol(base, Decl(arrayBestCommonTypes.ts, 1, 23))
|
|
|
|
|
|
class f {
|
|
>f : Symbol(f, Decl(arrayBestCommonTypes.ts, 4, 34))
|
|
|
|
public voidIfAny(x: boolean, y?: boolean): number;
|
|
>voidIfAny : Symbol(voidIfAny, Decl(arrayBestCommonTypes.ts, 7, 13), Decl(arrayBestCommonTypes.ts, 8, 58), Decl(arrayBestCommonTypes.ts, 9, 57), Decl(arrayBestCommonTypes.ts, 10, 57))
|
|
>x : Symbol(x, Decl(arrayBestCommonTypes.ts, 8, 25))
|
|
>y : Symbol(y, Decl(arrayBestCommonTypes.ts, 8, 36))
|
|
|
|
public voidIfAny(x: string, y?: boolean): number;
|
|
>voidIfAny : Symbol(voidIfAny, Decl(arrayBestCommonTypes.ts, 7, 13), Decl(arrayBestCommonTypes.ts, 8, 58), Decl(arrayBestCommonTypes.ts, 9, 57), Decl(arrayBestCommonTypes.ts, 10, 57))
|
|
>x : Symbol(x, Decl(arrayBestCommonTypes.ts, 9, 25))
|
|
>y : Symbol(y, Decl(arrayBestCommonTypes.ts, 9, 35))
|
|
|
|
public voidIfAny(x: number, y?: boolean): number;
|
|
>voidIfAny : Symbol(voidIfAny, Decl(arrayBestCommonTypes.ts, 7, 13), Decl(arrayBestCommonTypes.ts, 8, 58), Decl(arrayBestCommonTypes.ts, 9, 57), Decl(arrayBestCommonTypes.ts, 10, 57))
|
|
>x : Symbol(x, Decl(arrayBestCommonTypes.ts, 10, 25))
|
|
>y : Symbol(y, Decl(arrayBestCommonTypes.ts, 10, 35))
|
|
|
|
public voidIfAny(x: any, y = false): any { return null; }
|
|
>voidIfAny : Symbol(voidIfAny, Decl(arrayBestCommonTypes.ts, 7, 13), Decl(arrayBestCommonTypes.ts, 8, 58), Decl(arrayBestCommonTypes.ts, 9, 57), Decl(arrayBestCommonTypes.ts, 10, 57))
|
|
>x : Symbol(x, Decl(arrayBestCommonTypes.ts, 11, 25))
|
|
>y : Symbol(y, Decl(arrayBestCommonTypes.ts, 11, 32))
|
|
|
|
public x() {
|
|
>x : Symbol(x, Decl(arrayBestCommonTypes.ts, 11, 65))
|
|
|
|
<number>(this.voidIfAny([4, 2][0]));
|
|
>this.voidIfAny : Symbol(voidIfAny, Decl(arrayBestCommonTypes.ts, 7, 13), Decl(arrayBestCommonTypes.ts, 8, 58), Decl(arrayBestCommonTypes.ts, 9, 57), Decl(arrayBestCommonTypes.ts, 10, 57))
|
|
>this : Symbol(f, Decl(arrayBestCommonTypes.ts, 4, 34))
|
|
>voidIfAny : Symbol(voidIfAny, Decl(arrayBestCommonTypes.ts, 7, 13), Decl(arrayBestCommonTypes.ts, 8, 58), Decl(arrayBestCommonTypes.ts, 9, 57), Decl(arrayBestCommonTypes.ts, 10, 57))
|
|
|
|
<number>(this.voidIfAny([4, 2, undefined][0]));
|
|
>this.voidIfAny : Symbol(voidIfAny, Decl(arrayBestCommonTypes.ts, 7, 13), Decl(arrayBestCommonTypes.ts, 8, 58), Decl(arrayBestCommonTypes.ts, 9, 57), Decl(arrayBestCommonTypes.ts, 10, 57))
|
|
>this : Symbol(f, Decl(arrayBestCommonTypes.ts, 4, 34))
|
|
>voidIfAny : Symbol(voidIfAny, Decl(arrayBestCommonTypes.ts, 7, 13), Decl(arrayBestCommonTypes.ts, 8, 58), Decl(arrayBestCommonTypes.ts, 9, 57), Decl(arrayBestCommonTypes.ts, 10, 57))
|
|
>undefined : Symbol(undefined)
|
|
|
|
<number>(this.voidIfAny([undefined, 2, 4][0]));
|
|
>this.voidIfAny : Symbol(voidIfAny, Decl(arrayBestCommonTypes.ts, 7, 13), Decl(arrayBestCommonTypes.ts, 8, 58), Decl(arrayBestCommonTypes.ts, 9, 57), Decl(arrayBestCommonTypes.ts, 10, 57))
|
|
>this : Symbol(f, Decl(arrayBestCommonTypes.ts, 4, 34))
|
|
>voidIfAny : Symbol(voidIfAny, Decl(arrayBestCommonTypes.ts, 7, 13), Decl(arrayBestCommonTypes.ts, 8, 58), Decl(arrayBestCommonTypes.ts, 9, 57), Decl(arrayBestCommonTypes.ts, 10, 57))
|
|
>undefined : Symbol(undefined)
|
|
|
|
<number>(this.voidIfAny([null, 2, 4][0]));
|
|
>this.voidIfAny : Symbol(voidIfAny, Decl(arrayBestCommonTypes.ts, 7, 13), Decl(arrayBestCommonTypes.ts, 8, 58), Decl(arrayBestCommonTypes.ts, 9, 57), Decl(arrayBestCommonTypes.ts, 10, 57))
|
|
>this : Symbol(f, Decl(arrayBestCommonTypes.ts, 4, 34))
|
|
>voidIfAny : Symbol(voidIfAny, Decl(arrayBestCommonTypes.ts, 7, 13), Decl(arrayBestCommonTypes.ts, 8, 58), Decl(arrayBestCommonTypes.ts, 9, 57), Decl(arrayBestCommonTypes.ts, 10, 57))
|
|
|
|
<number>(this.voidIfAny([2, 4, null][0]));
|
|
>this.voidIfAny : Symbol(voidIfAny, Decl(arrayBestCommonTypes.ts, 7, 13), Decl(arrayBestCommonTypes.ts, 8, 58), Decl(arrayBestCommonTypes.ts, 9, 57), Decl(arrayBestCommonTypes.ts, 10, 57))
|
|
>this : Symbol(f, Decl(arrayBestCommonTypes.ts, 4, 34))
|
|
>voidIfAny : Symbol(voidIfAny, Decl(arrayBestCommonTypes.ts, 7, 13), Decl(arrayBestCommonTypes.ts, 8, 58), Decl(arrayBestCommonTypes.ts, 9, 57), Decl(arrayBestCommonTypes.ts, 10, 57))
|
|
|
|
<number>(this.voidIfAny([undefined, 4, null][0]));
|
|
>this.voidIfAny : Symbol(voidIfAny, Decl(arrayBestCommonTypes.ts, 7, 13), Decl(arrayBestCommonTypes.ts, 8, 58), Decl(arrayBestCommonTypes.ts, 9, 57), Decl(arrayBestCommonTypes.ts, 10, 57))
|
|
>this : Symbol(f, Decl(arrayBestCommonTypes.ts, 4, 34))
|
|
>voidIfAny : Symbol(voidIfAny, Decl(arrayBestCommonTypes.ts, 7, 13), Decl(arrayBestCommonTypes.ts, 8, 58), Decl(arrayBestCommonTypes.ts, 9, 57), Decl(arrayBestCommonTypes.ts, 10, 57))
|
|
>undefined : Symbol(undefined)
|
|
|
|
<number>(this.voidIfAny(['', "q"][0]));
|
|
>this.voidIfAny : Symbol(voidIfAny, Decl(arrayBestCommonTypes.ts, 7, 13), Decl(arrayBestCommonTypes.ts, 8, 58), Decl(arrayBestCommonTypes.ts, 9, 57), Decl(arrayBestCommonTypes.ts, 10, 57))
|
|
>this : Symbol(f, Decl(arrayBestCommonTypes.ts, 4, 34))
|
|
>voidIfAny : Symbol(voidIfAny, Decl(arrayBestCommonTypes.ts, 7, 13), Decl(arrayBestCommonTypes.ts, 8, 58), Decl(arrayBestCommonTypes.ts, 9, 57), Decl(arrayBestCommonTypes.ts, 10, 57))
|
|
|
|
<number>(this.voidIfAny(['', "q", undefined][0]));
|
|
>this.voidIfAny : Symbol(voidIfAny, Decl(arrayBestCommonTypes.ts, 7, 13), Decl(arrayBestCommonTypes.ts, 8, 58), Decl(arrayBestCommonTypes.ts, 9, 57), Decl(arrayBestCommonTypes.ts, 10, 57))
|
|
>this : Symbol(f, Decl(arrayBestCommonTypes.ts, 4, 34))
|
|
>voidIfAny : Symbol(voidIfAny, Decl(arrayBestCommonTypes.ts, 7, 13), Decl(arrayBestCommonTypes.ts, 8, 58), Decl(arrayBestCommonTypes.ts, 9, 57), Decl(arrayBestCommonTypes.ts, 10, 57))
|
|
>undefined : Symbol(undefined)
|
|
|
|
<number>(this.voidIfAny([undefined, "q", ''][0]));
|
|
>this.voidIfAny : Symbol(voidIfAny, Decl(arrayBestCommonTypes.ts, 7, 13), Decl(arrayBestCommonTypes.ts, 8, 58), Decl(arrayBestCommonTypes.ts, 9, 57), Decl(arrayBestCommonTypes.ts, 10, 57))
|
|
>this : Symbol(f, Decl(arrayBestCommonTypes.ts, 4, 34))
|
|
>voidIfAny : Symbol(voidIfAny, Decl(arrayBestCommonTypes.ts, 7, 13), Decl(arrayBestCommonTypes.ts, 8, 58), Decl(arrayBestCommonTypes.ts, 9, 57), Decl(arrayBestCommonTypes.ts, 10, 57))
|
|
>undefined : Symbol(undefined)
|
|
|
|
<number>(this.voidIfAny([null, "q", ''][0]));
|
|
>this.voidIfAny : Symbol(voidIfAny, Decl(arrayBestCommonTypes.ts, 7, 13), Decl(arrayBestCommonTypes.ts, 8, 58), Decl(arrayBestCommonTypes.ts, 9, 57), Decl(arrayBestCommonTypes.ts, 10, 57))
|
|
>this : Symbol(f, Decl(arrayBestCommonTypes.ts, 4, 34))
|
|
>voidIfAny : Symbol(voidIfAny, Decl(arrayBestCommonTypes.ts, 7, 13), Decl(arrayBestCommonTypes.ts, 8, 58), Decl(arrayBestCommonTypes.ts, 9, 57), Decl(arrayBestCommonTypes.ts, 10, 57))
|
|
|
|
<number>(this.voidIfAny(["q", '', null][0]));
|
|
>this.voidIfAny : Symbol(voidIfAny, Decl(arrayBestCommonTypes.ts, 7, 13), Decl(arrayBestCommonTypes.ts, 8, 58), Decl(arrayBestCommonTypes.ts, 9, 57), Decl(arrayBestCommonTypes.ts, 10, 57))
|
|
>this : Symbol(f, Decl(arrayBestCommonTypes.ts, 4, 34))
|
|
>voidIfAny : Symbol(voidIfAny, Decl(arrayBestCommonTypes.ts, 7, 13), Decl(arrayBestCommonTypes.ts, 8, 58), Decl(arrayBestCommonTypes.ts, 9, 57), Decl(arrayBestCommonTypes.ts, 10, 57))
|
|
|
|
<number>(this.voidIfAny([undefined, '', null][0]));
|
|
>this.voidIfAny : Symbol(voidIfAny, Decl(arrayBestCommonTypes.ts, 7, 13), Decl(arrayBestCommonTypes.ts, 8, 58), Decl(arrayBestCommonTypes.ts, 9, 57), Decl(arrayBestCommonTypes.ts, 10, 57))
|
|
>this : Symbol(f, Decl(arrayBestCommonTypes.ts, 4, 34))
|
|
>voidIfAny : Symbol(voidIfAny, Decl(arrayBestCommonTypes.ts, 7, 13), Decl(arrayBestCommonTypes.ts, 8, 58), Decl(arrayBestCommonTypes.ts, 9, 57), Decl(arrayBestCommonTypes.ts, 10, 57))
|
|
>undefined : Symbol(undefined)
|
|
|
|
<number>(this.voidIfAny([[3, 4], [null]][0][0]));
|
|
>this.voidIfAny : Symbol(voidIfAny, Decl(arrayBestCommonTypes.ts, 7, 13), Decl(arrayBestCommonTypes.ts, 8, 58), Decl(arrayBestCommonTypes.ts, 9, 57), Decl(arrayBestCommonTypes.ts, 10, 57))
|
|
>this : Symbol(f, Decl(arrayBestCommonTypes.ts, 4, 34))
|
|
>voidIfAny : Symbol(voidIfAny, Decl(arrayBestCommonTypes.ts, 7, 13), Decl(arrayBestCommonTypes.ts, 8, 58), Decl(arrayBestCommonTypes.ts, 9, 57), Decl(arrayBestCommonTypes.ts, 10, 57))
|
|
|
|
|
|
var t1: { x: number; y: base; }[] = [{ x: 7, y: new derived() }, { x: 5, y: new base() }];
|
|
>t1 : Symbol(t1, Decl(arrayBestCommonTypes.ts, 31, 15))
|
|
>x : Symbol(x, Decl(arrayBestCommonTypes.ts, 31, 21))
|
|
>y : Symbol(y, Decl(arrayBestCommonTypes.ts, 31, 32))
|
|
>base : Symbol(base, Decl(arrayBestCommonTypes.ts, 1, 23))
|
|
>x : Symbol(x, Decl(arrayBestCommonTypes.ts, 31, 50))
|
|
>y : Symbol(y, Decl(arrayBestCommonTypes.ts, 31, 56))
|
|
>derived : Symbol(derived, Decl(arrayBestCommonTypes.ts, 3, 36))
|
|
>x : Symbol(x, Decl(arrayBestCommonTypes.ts, 31, 78))
|
|
>y : Symbol(y, Decl(arrayBestCommonTypes.ts, 31, 84))
|
|
>base : Symbol(base, Decl(arrayBestCommonTypes.ts, 1, 23))
|
|
|
|
var t2: { x: boolean; y: base; }[] = [{ x: true, y: new derived() }, { x: false, y: new base() }];
|
|
>t2 : Symbol(t2, Decl(arrayBestCommonTypes.ts, 32, 15))
|
|
>x : Symbol(x, Decl(arrayBestCommonTypes.ts, 32, 21))
|
|
>y : Symbol(y, Decl(arrayBestCommonTypes.ts, 32, 33))
|
|
>base : Symbol(base, Decl(arrayBestCommonTypes.ts, 1, 23))
|
|
>x : Symbol(x, Decl(arrayBestCommonTypes.ts, 32, 51))
|
|
>y : Symbol(y, Decl(arrayBestCommonTypes.ts, 32, 60))
|
|
>derived : Symbol(derived, Decl(arrayBestCommonTypes.ts, 3, 36))
|
|
>x : Symbol(x, Decl(arrayBestCommonTypes.ts, 32, 82))
|
|
>y : Symbol(y, Decl(arrayBestCommonTypes.ts, 32, 92))
|
|
>base : Symbol(base, Decl(arrayBestCommonTypes.ts, 1, 23))
|
|
|
|
var t3: { x: string; y: base; }[] = [{ x: undefined, y: new base() }, { x: '', y: new derived() }];
|
|
>t3 : Symbol(t3, Decl(arrayBestCommonTypes.ts, 33, 15))
|
|
>x : Symbol(x, Decl(arrayBestCommonTypes.ts, 33, 21))
|
|
>y : Symbol(y, Decl(arrayBestCommonTypes.ts, 33, 32))
|
|
>base : Symbol(base, Decl(arrayBestCommonTypes.ts, 1, 23))
|
|
>x : Symbol(x, Decl(arrayBestCommonTypes.ts, 33, 50))
|
|
>undefined : Symbol(undefined)
|
|
>y : Symbol(y, Decl(arrayBestCommonTypes.ts, 33, 64))
|
|
>base : Symbol(base, Decl(arrayBestCommonTypes.ts, 1, 23))
|
|
>x : Symbol(x, Decl(arrayBestCommonTypes.ts, 33, 83))
|
|
>y : Symbol(y, Decl(arrayBestCommonTypes.ts, 33, 90))
|
|
>derived : Symbol(derived, Decl(arrayBestCommonTypes.ts, 3, 36))
|
|
|
|
var anyObj: any = null;
|
|
>anyObj : Symbol(anyObj, Decl(arrayBestCommonTypes.ts, 35, 15))
|
|
|
|
// Order matters here so test all the variants
|
|
var a1 = [{ x: 0, y: 'a' }, { x: 'a', y: 'a' }, { x: anyObj, y: 'a' }];
|
|
>a1 : Symbol(a1, Decl(arrayBestCommonTypes.ts, 37, 15))
|
|
>x : Symbol(x, Decl(arrayBestCommonTypes.ts, 37, 23))
|
|
>y : Symbol(y, Decl(arrayBestCommonTypes.ts, 37, 29))
|
|
>x : Symbol(x, Decl(arrayBestCommonTypes.ts, 37, 41))
|
|
>y : Symbol(y, Decl(arrayBestCommonTypes.ts, 37, 49))
|
|
>x : Symbol(x, Decl(arrayBestCommonTypes.ts, 37, 61))
|
|
>anyObj : Symbol(anyObj, Decl(arrayBestCommonTypes.ts, 35, 15))
|
|
>y : Symbol(y, Decl(arrayBestCommonTypes.ts, 37, 72))
|
|
|
|
var a2 = [{ x: anyObj, y: 'a' }, { x: 0, y: 'a' }, { x: 'a', y: 'a' }];
|
|
>a2 : Symbol(a2, Decl(arrayBestCommonTypes.ts, 38, 15))
|
|
>x : Symbol(x, Decl(arrayBestCommonTypes.ts, 38, 23))
|
|
>anyObj : Symbol(anyObj, Decl(arrayBestCommonTypes.ts, 35, 15))
|
|
>y : Symbol(y, Decl(arrayBestCommonTypes.ts, 38, 34))
|
|
>x : Symbol(x, Decl(arrayBestCommonTypes.ts, 38, 46))
|
|
>y : Symbol(y, Decl(arrayBestCommonTypes.ts, 38, 52))
|
|
>x : Symbol(x, Decl(arrayBestCommonTypes.ts, 38, 64))
|
|
>y : Symbol(y, Decl(arrayBestCommonTypes.ts, 38, 72))
|
|
|
|
var a3 = [{ x: 0, y: 'a' }, { x: anyObj, y: 'a' }, { x: 'a', y: 'a' }];
|
|
>a3 : Symbol(a3, Decl(arrayBestCommonTypes.ts, 39, 15))
|
|
>x : Symbol(x, Decl(arrayBestCommonTypes.ts, 39, 23))
|
|
>y : Symbol(y, Decl(arrayBestCommonTypes.ts, 39, 29))
|
|
>x : Symbol(x, Decl(arrayBestCommonTypes.ts, 39, 41))
|
|
>anyObj : Symbol(anyObj, Decl(arrayBestCommonTypes.ts, 35, 15))
|
|
>y : Symbol(y, Decl(arrayBestCommonTypes.ts, 39, 52))
|
|
>x : Symbol(x, Decl(arrayBestCommonTypes.ts, 39, 64))
|
|
>y : Symbol(y, Decl(arrayBestCommonTypes.ts, 39, 72))
|
|
|
|
var ifaceObj: iface = null;
|
|
>ifaceObj : Symbol(ifaceObj, Decl(arrayBestCommonTypes.ts, 41, 15))
|
|
>iface : Symbol(iface, Decl(arrayBestCommonTypes.ts, 0, 19))
|
|
|
|
var baseObj = new base();
|
|
>baseObj : Symbol(baseObj, Decl(arrayBestCommonTypes.ts, 42, 15))
|
|
>base : Symbol(base, Decl(arrayBestCommonTypes.ts, 1, 23))
|
|
|
|
var base2Obj = new base2();
|
|
>base2Obj : Symbol(base2Obj, Decl(arrayBestCommonTypes.ts, 43, 15))
|
|
>base2 : Symbol(base2, Decl(arrayBestCommonTypes.ts, 2, 35))
|
|
|
|
var b1 = [baseObj, base2Obj, ifaceObj];
|
|
>b1 : Symbol(b1, Decl(arrayBestCommonTypes.ts, 45, 15))
|
|
>baseObj : Symbol(baseObj, Decl(arrayBestCommonTypes.ts, 42, 15))
|
|
>base2Obj : Symbol(base2Obj, Decl(arrayBestCommonTypes.ts, 43, 15))
|
|
>ifaceObj : Symbol(ifaceObj, Decl(arrayBestCommonTypes.ts, 41, 15))
|
|
|
|
var b2 = [base2Obj, baseObj, ifaceObj];
|
|
>b2 : Symbol(b2, Decl(arrayBestCommonTypes.ts, 46, 15))
|
|
>base2Obj : Symbol(base2Obj, Decl(arrayBestCommonTypes.ts, 43, 15))
|
|
>baseObj : Symbol(baseObj, Decl(arrayBestCommonTypes.ts, 42, 15))
|
|
>ifaceObj : Symbol(ifaceObj, Decl(arrayBestCommonTypes.ts, 41, 15))
|
|
|
|
var b3 = [baseObj, ifaceObj, base2Obj];
|
|
>b3 : Symbol(b3, Decl(arrayBestCommonTypes.ts, 47, 15))
|
|
>baseObj : Symbol(baseObj, Decl(arrayBestCommonTypes.ts, 42, 15))
|
|
>ifaceObj : Symbol(ifaceObj, Decl(arrayBestCommonTypes.ts, 41, 15))
|
|
>base2Obj : Symbol(base2Obj, Decl(arrayBestCommonTypes.ts, 43, 15))
|
|
|
|
var b4 = [ifaceObj, baseObj, base2Obj];
|
|
>b4 : Symbol(b4, Decl(arrayBestCommonTypes.ts, 48, 15))
|
|
>ifaceObj : Symbol(ifaceObj, Decl(arrayBestCommonTypes.ts, 41, 15))
|
|
>baseObj : Symbol(baseObj, Decl(arrayBestCommonTypes.ts, 42, 15))
|
|
>base2Obj : Symbol(base2Obj, Decl(arrayBestCommonTypes.ts, 43, 15))
|
|
}
|
|
}
|
|
}
|
|
|
|
module NonEmptyTypes {
|
|
>NonEmptyTypes : Symbol(NonEmptyTypes, Decl(arrayBestCommonTypes.ts, 51, 1))
|
|
|
|
interface iface { x: string; }
|
|
>iface : Symbol(iface, Decl(arrayBestCommonTypes.ts, 53, 22))
|
|
>x : Symbol(x, Decl(arrayBestCommonTypes.ts, 54, 21))
|
|
|
|
class base implements iface { x: string; y: string; }
|
|
>base : Symbol(base, Decl(arrayBestCommonTypes.ts, 54, 34))
|
|
>iface : Symbol(iface, Decl(arrayBestCommonTypes.ts, 53, 22))
|
|
>x : Symbol(x, Decl(arrayBestCommonTypes.ts, 55, 33))
|
|
>y : Symbol(y, Decl(arrayBestCommonTypes.ts, 55, 44))
|
|
|
|
class base2 implements iface { x: string; z: string; }
|
|
>base2 : Symbol(base2, Decl(arrayBestCommonTypes.ts, 55, 57))
|
|
>iface : Symbol(iface, Decl(arrayBestCommonTypes.ts, 53, 22))
|
|
>x : Symbol(x, Decl(arrayBestCommonTypes.ts, 56, 34))
|
|
>z : Symbol(z, Decl(arrayBestCommonTypes.ts, 56, 45))
|
|
|
|
class derived extends base { a: string; }
|
|
>derived : Symbol(derived, Decl(arrayBestCommonTypes.ts, 56, 58))
|
|
>base : Symbol(base, Decl(arrayBestCommonTypes.ts, 54, 34))
|
|
>a : Symbol(a, Decl(arrayBestCommonTypes.ts, 57, 32))
|
|
|
|
|
|
class f {
|
|
>f : Symbol(f, Decl(arrayBestCommonTypes.ts, 57, 45))
|
|
|
|
public voidIfAny(x: boolean, y?: boolean): number;
|
|
>voidIfAny : Symbol(voidIfAny, Decl(arrayBestCommonTypes.ts, 60, 13), Decl(arrayBestCommonTypes.ts, 61, 58), Decl(arrayBestCommonTypes.ts, 62, 57), Decl(arrayBestCommonTypes.ts, 63, 57))
|
|
>x : Symbol(x, Decl(arrayBestCommonTypes.ts, 61, 25))
|
|
>y : Symbol(y, Decl(arrayBestCommonTypes.ts, 61, 36))
|
|
|
|
public voidIfAny(x: string, y?: boolean): number;
|
|
>voidIfAny : Symbol(voidIfAny, Decl(arrayBestCommonTypes.ts, 60, 13), Decl(arrayBestCommonTypes.ts, 61, 58), Decl(arrayBestCommonTypes.ts, 62, 57), Decl(arrayBestCommonTypes.ts, 63, 57))
|
|
>x : Symbol(x, Decl(arrayBestCommonTypes.ts, 62, 25))
|
|
>y : Symbol(y, Decl(arrayBestCommonTypes.ts, 62, 35))
|
|
|
|
public voidIfAny(x: number, y?: boolean): number;
|
|
>voidIfAny : Symbol(voidIfAny, Decl(arrayBestCommonTypes.ts, 60, 13), Decl(arrayBestCommonTypes.ts, 61, 58), Decl(arrayBestCommonTypes.ts, 62, 57), Decl(arrayBestCommonTypes.ts, 63, 57))
|
|
>x : Symbol(x, Decl(arrayBestCommonTypes.ts, 63, 25))
|
|
>y : Symbol(y, Decl(arrayBestCommonTypes.ts, 63, 35))
|
|
|
|
public voidIfAny(x: any, y = false): any { return null; }
|
|
>voidIfAny : Symbol(voidIfAny, Decl(arrayBestCommonTypes.ts, 60, 13), Decl(arrayBestCommonTypes.ts, 61, 58), Decl(arrayBestCommonTypes.ts, 62, 57), Decl(arrayBestCommonTypes.ts, 63, 57))
|
|
>x : Symbol(x, Decl(arrayBestCommonTypes.ts, 64, 25))
|
|
>y : Symbol(y, Decl(arrayBestCommonTypes.ts, 64, 32))
|
|
|
|
public x() {
|
|
>x : Symbol(x, Decl(arrayBestCommonTypes.ts, 64, 65))
|
|
|
|
<number>(this.voidIfAny([4, 2][0]));
|
|
>this.voidIfAny : Symbol(voidIfAny, Decl(arrayBestCommonTypes.ts, 60, 13), Decl(arrayBestCommonTypes.ts, 61, 58), Decl(arrayBestCommonTypes.ts, 62, 57), Decl(arrayBestCommonTypes.ts, 63, 57))
|
|
>this : Symbol(f, Decl(arrayBestCommonTypes.ts, 57, 45))
|
|
>voidIfAny : Symbol(voidIfAny, Decl(arrayBestCommonTypes.ts, 60, 13), Decl(arrayBestCommonTypes.ts, 61, 58), Decl(arrayBestCommonTypes.ts, 62, 57), Decl(arrayBestCommonTypes.ts, 63, 57))
|
|
|
|
<number>(this.voidIfAny([4, 2, undefined][0]));
|
|
>this.voidIfAny : Symbol(voidIfAny, Decl(arrayBestCommonTypes.ts, 60, 13), Decl(arrayBestCommonTypes.ts, 61, 58), Decl(arrayBestCommonTypes.ts, 62, 57), Decl(arrayBestCommonTypes.ts, 63, 57))
|
|
>this : Symbol(f, Decl(arrayBestCommonTypes.ts, 57, 45))
|
|
>voidIfAny : Symbol(voidIfAny, Decl(arrayBestCommonTypes.ts, 60, 13), Decl(arrayBestCommonTypes.ts, 61, 58), Decl(arrayBestCommonTypes.ts, 62, 57), Decl(arrayBestCommonTypes.ts, 63, 57))
|
|
>undefined : Symbol(undefined)
|
|
|
|
<number>(this.voidIfAny([undefined, 2, 4][0]));
|
|
>this.voidIfAny : Symbol(voidIfAny, Decl(arrayBestCommonTypes.ts, 60, 13), Decl(arrayBestCommonTypes.ts, 61, 58), Decl(arrayBestCommonTypes.ts, 62, 57), Decl(arrayBestCommonTypes.ts, 63, 57))
|
|
>this : Symbol(f, Decl(arrayBestCommonTypes.ts, 57, 45))
|
|
>voidIfAny : Symbol(voidIfAny, Decl(arrayBestCommonTypes.ts, 60, 13), Decl(arrayBestCommonTypes.ts, 61, 58), Decl(arrayBestCommonTypes.ts, 62, 57), Decl(arrayBestCommonTypes.ts, 63, 57))
|
|
>undefined : Symbol(undefined)
|
|
|
|
<number>(this.voidIfAny([null, 2, 4][0]));
|
|
>this.voidIfAny : Symbol(voidIfAny, Decl(arrayBestCommonTypes.ts, 60, 13), Decl(arrayBestCommonTypes.ts, 61, 58), Decl(arrayBestCommonTypes.ts, 62, 57), Decl(arrayBestCommonTypes.ts, 63, 57))
|
|
>this : Symbol(f, Decl(arrayBestCommonTypes.ts, 57, 45))
|
|
>voidIfAny : Symbol(voidIfAny, Decl(arrayBestCommonTypes.ts, 60, 13), Decl(arrayBestCommonTypes.ts, 61, 58), Decl(arrayBestCommonTypes.ts, 62, 57), Decl(arrayBestCommonTypes.ts, 63, 57))
|
|
|
|
<number>(this.voidIfAny([2, 4, null][0]));
|
|
>this.voidIfAny : Symbol(voidIfAny, Decl(arrayBestCommonTypes.ts, 60, 13), Decl(arrayBestCommonTypes.ts, 61, 58), Decl(arrayBestCommonTypes.ts, 62, 57), Decl(arrayBestCommonTypes.ts, 63, 57))
|
|
>this : Symbol(f, Decl(arrayBestCommonTypes.ts, 57, 45))
|
|
>voidIfAny : Symbol(voidIfAny, Decl(arrayBestCommonTypes.ts, 60, 13), Decl(arrayBestCommonTypes.ts, 61, 58), Decl(arrayBestCommonTypes.ts, 62, 57), Decl(arrayBestCommonTypes.ts, 63, 57))
|
|
|
|
<number>(this.voidIfAny([undefined, 4, null][0]));
|
|
>this.voidIfAny : Symbol(voidIfAny, Decl(arrayBestCommonTypes.ts, 60, 13), Decl(arrayBestCommonTypes.ts, 61, 58), Decl(arrayBestCommonTypes.ts, 62, 57), Decl(arrayBestCommonTypes.ts, 63, 57))
|
|
>this : Symbol(f, Decl(arrayBestCommonTypes.ts, 57, 45))
|
|
>voidIfAny : Symbol(voidIfAny, Decl(arrayBestCommonTypes.ts, 60, 13), Decl(arrayBestCommonTypes.ts, 61, 58), Decl(arrayBestCommonTypes.ts, 62, 57), Decl(arrayBestCommonTypes.ts, 63, 57))
|
|
>undefined : Symbol(undefined)
|
|
|
|
<number>(this.voidIfAny(['', "q"][0]));
|
|
>this.voidIfAny : Symbol(voidIfAny, Decl(arrayBestCommonTypes.ts, 60, 13), Decl(arrayBestCommonTypes.ts, 61, 58), Decl(arrayBestCommonTypes.ts, 62, 57), Decl(arrayBestCommonTypes.ts, 63, 57))
|
|
>this : Symbol(f, Decl(arrayBestCommonTypes.ts, 57, 45))
|
|
>voidIfAny : Symbol(voidIfAny, Decl(arrayBestCommonTypes.ts, 60, 13), Decl(arrayBestCommonTypes.ts, 61, 58), Decl(arrayBestCommonTypes.ts, 62, 57), Decl(arrayBestCommonTypes.ts, 63, 57))
|
|
|
|
<number>(this.voidIfAny(['', "q", undefined][0]));
|
|
>this.voidIfAny : Symbol(voidIfAny, Decl(arrayBestCommonTypes.ts, 60, 13), Decl(arrayBestCommonTypes.ts, 61, 58), Decl(arrayBestCommonTypes.ts, 62, 57), Decl(arrayBestCommonTypes.ts, 63, 57))
|
|
>this : Symbol(f, Decl(arrayBestCommonTypes.ts, 57, 45))
|
|
>voidIfAny : Symbol(voidIfAny, Decl(arrayBestCommonTypes.ts, 60, 13), Decl(arrayBestCommonTypes.ts, 61, 58), Decl(arrayBestCommonTypes.ts, 62, 57), Decl(arrayBestCommonTypes.ts, 63, 57))
|
|
>undefined : Symbol(undefined)
|
|
|
|
<number>(this.voidIfAny([undefined, "q", ''][0]));
|
|
>this.voidIfAny : Symbol(voidIfAny, Decl(arrayBestCommonTypes.ts, 60, 13), Decl(arrayBestCommonTypes.ts, 61, 58), Decl(arrayBestCommonTypes.ts, 62, 57), Decl(arrayBestCommonTypes.ts, 63, 57))
|
|
>this : Symbol(f, Decl(arrayBestCommonTypes.ts, 57, 45))
|
|
>voidIfAny : Symbol(voidIfAny, Decl(arrayBestCommonTypes.ts, 60, 13), Decl(arrayBestCommonTypes.ts, 61, 58), Decl(arrayBestCommonTypes.ts, 62, 57), Decl(arrayBestCommonTypes.ts, 63, 57))
|
|
>undefined : Symbol(undefined)
|
|
|
|
<number>(this.voidIfAny([null, "q", ''][0]));
|
|
>this.voidIfAny : Symbol(voidIfAny, Decl(arrayBestCommonTypes.ts, 60, 13), Decl(arrayBestCommonTypes.ts, 61, 58), Decl(arrayBestCommonTypes.ts, 62, 57), Decl(arrayBestCommonTypes.ts, 63, 57))
|
|
>this : Symbol(f, Decl(arrayBestCommonTypes.ts, 57, 45))
|
|
>voidIfAny : Symbol(voidIfAny, Decl(arrayBestCommonTypes.ts, 60, 13), Decl(arrayBestCommonTypes.ts, 61, 58), Decl(arrayBestCommonTypes.ts, 62, 57), Decl(arrayBestCommonTypes.ts, 63, 57))
|
|
|
|
<number>(this.voidIfAny(["q", '', null][0]));
|
|
>this.voidIfAny : Symbol(voidIfAny, Decl(arrayBestCommonTypes.ts, 60, 13), Decl(arrayBestCommonTypes.ts, 61, 58), Decl(arrayBestCommonTypes.ts, 62, 57), Decl(arrayBestCommonTypes.ts, 63, 57))
|
|
>this : Symbol(f, Decl(arrayBestCommonTypes.ts, 57, 45))
|
|
>voidIfAny : Symbol(voidIfAny, Decl(arrayBestCommonTypes.ts, 60, 13), Decl(arrayBestCommonTypes.ts, 61, 58), Decl(arrayBestCommonTypes.ts, 62, 57), Decl(arrayBestCommonTypes.ts, 63, 57))
|
|
|
|
<number>(this.voidIfAny([undefined, '', null][0]));
|
|
>this.voidIfAny : Symbol(voidIfAny, Decl(arrayBestCommonTypes.ts, 60, 13), Decl(arrayBestCommonTypes.ts, 61, 58), Decl(arrayBestCommonTypes.ts, 62, 57), Decl(arrayBestCommonTypes.ts, 63, 57))
|
|
>this : Symbol(f, Decl(arrayBestCommonTypes.ts, 57, 45))
|
|
>voidIfAny : Symbol(voidIfAny, Decl(arrayBestCommonTypes.ts, 60, 13), Decl(arrayBestCommonTypes.ts, 61, 58), Decl(arrayBestCommonTypes.ts, 62, 57), Decl(arrayBestCommonTypes.ts, 63, 57))
|
|
>undefined : Symbol(undefined)
|
|
|
|
<number>(this.voidIfAny([[3, 4], [null]][0][0]));
|
|
>this.voidIfAny : Symbol(voidIfAny, Decl(arrayBestCommonTypes.ts, 60, 13), Decl(arrayBestCommonTypes.ts, 61, 58), Decl(arrayBestCommonTypes.ts, 62, 57), Decl(arrayBestCommonTypes.ts, 63, 57))
|
|
>this : Symbol(f, Decl(arrayBestCommonTypes.ts, 57, 45))
|
|
>voidIfAny : Symbol(voidIfAny, Decl(arrayBestCommonTypes.ts, 60, 13), Decl(arrayBestCommonTypes.ts, 61, 58), Decl(arrayBestCommonTypes.ts, 62, 57), Decl(arrayBestCommonTypes.ts, 63, 57))
|
|
|
|
|
|
var t1: { x: number; y: base; }[] = [{ x: 7, y: new derived() }, { x: 5, y: new base() }];
|
|
>t1 : Symbol(t1, Decl(arrayBestCommonTypes.ts, 84, 15))
|
|
>x : Symbol(x, Decl(arrayBestCommonTypes.ts, 84, 21))
|
|
>y : Symbol(y, Decl(arrayBestCommonTypes.ts, 84, 32))
|
|
>base : Symbol(base, Decl(arrayBestCommonTypes.ts, 54, 34))
|
|
>x : Symbol(x, Decl(arrayBestCommonTypes.ts, 84, 50))
|
|
>y : Symbol(y, Decl(arrayBestCommonTypes.ts, 84, 56))
|
|
>derived : Symbol(derived, Decl(arrayBestCommonTypes.ts, 56, 58))
|
|
>x : Symbol(x, Decl(arrayBestCommonTypes.ts, 84, 78))
|
|
>y : Symbol(y, Decl(arrayBestCommonTypes.ts, 84, 84))
|
|
>base : Symbol(base, Decl(arrayBestCommonTypes.ts, 54, 34))
|
|
|
|
var t2: { x: boolean; y: base; }[] = [{ x: true, y: new derived() }, { x: false, y: new base() }];
|
|
>t2 : Symbol(t2, Decl(arrayBestCommonTypes.ts, 85, 15))
|
|
>x : Symbol(x, Decl(arrayBestCommonTypes.ts, 85, 21))
|
|
>y : Symbol(y, Decl(arrayBestCommonTypes.ts, 85, 33))
|
|
>base : Symbol(base, Decl(arrayBestCommonTypes.ts, 54, 34))
|
|
>x : Symbol(x, Decl(arrayBestCommonTypes.ts, 85, 51))
|
|
>y : Symbol(y, Decl(arrayBestCommonTypes.ts, 85, 60))
|
|
>derived : Symbol(derived, Decl(arrayBestCommonTypes.ts, 56, 58))
|
|
>x : Symbol(x, Decl(arrayBestCommonTypes.ts, 85, 82))
|
|
>y : Symbol(y, Decl(arrayBestCommonTypes.ts, 85, 92))
|
|
>base : Symbol(base, Decl(arrayBestCommonTypes.ts, 54, 34))
|
|
|
|
var t3: { x: string; y: base; }[] = [{ x: undefined, y: new base() }, { x: '', y: new derived() }];
|
|
>t3 : Symbol(t3, Decl(arrayBestCommonTypes.ts, 86, 15))
|
|
>x : Symbol(x, Decl(arrayBestCommonTypes.ts, 86, 21))
|
|
>y : Symbol(y, Decl(arrayBestCommonTypes.ts, 86, 32))
|
|
>base : Symbol(base, Decl(arrayBestCommonTypes.ts, 54, 34))
|
|
>x : Symbol(x, Decl(arrayBestCommonTypes.ts, 86, 50))
|
|
>undefined : Symbol(undefined)
|
|
>y : Symbol(y, Decl(arrayBestCommonTypes.ts, 86, 64))
|
|
>base : Symbol(base, Decl(arrayBestCommonTypes.ts, 54, 34))
|
|
>x : Symbol(x, Decl(arrayBestCommonTypes.ts, 86, 83))
|
|
>y : Symbol(y, Decl(arrayBestCommonTypes.ts, 86, 90))
|
|
>derived : Symbol(derived, Decl(arrayBestCommonTypes.ts, 56, 58))
|
|
|
|
var anyObj: any = null;
|
|
>anyObj : Symbol(anyObj, Decl(arrayBestCommonTypes.ts, 88, 15))
|
|
|
|
// Order matters here so test all the variants
|
|
var a1 = [{ x: 0, y: 'a' }, { x: 'a', y: 'a' }, { x: anyObj, y: 'a' }];
|
|
>a1 : Symbol(a1, Decl(arrayBestCommonTypes.ts, 90, 15))
|
|
>x : Symbol(x, Decl(arrayBestCommonTypes.ts, 90, 23))
|
|
>y : Symbol(y, Decl(arrayBestCommonTypes.ts, 90, 29))
|
|
>x : Symbol(x, Decl(arrayBestCommonTypes.ts, 90, 41))
|
|
>y : Symbol(y, Decl(arrayBestCommonTypes.ts, 90, 49))
|
|
>x : Symbol(x, Decl(arrayBestCommonTypes.ts, 90, 61))
|
|
>anyObj : Symbol(anyObj, Decl(arrayBestCommonTypes.ts, 88, 15))
|
|
>y : Symbol(y, Decl(arrayBestCommonTypes.ts, 90, 72))
|
|
|
|
var a2 = [{ x: anyObj, y: 'a' }, { x: 0, y: 'a' }, { x: 'a', y: 'a' }];
|
|
>a2 : Symbol(a2, Decl(arrayBestCommonTypes.ts, 91, 15))
|
|
>x : Symbol(x, Decl(arrayBestCommonTypes.ts, 91, 23))
|
|
>anyObj : Symbol(anyObj, Decl(arrayBestCommonTypes.ts, 88, 15))
|
|
>y : Symbol(y, Decl(arrayBestCommonTypes.ts, 91, 34))
|
|
>x : Symbol(x, Decl(arrayBestCommonTypes.ts, 91, 46))
|
|
>y : Symbol(y, Decl(arrayBestCommonTypes.ts, 91, 52))
|
|
>x : Symbol(x, Decl(arrayBestCommonTypes.ts, 91, 64))
|
|
>y : Symbol(y, Decl(arrayBestCommonTypes.ts, 91, 72))
|
|
|
|
var a3 = [{ x: 0, y: 'a' }, { x: anyObj, y: 'a' }, { x: 'a', y: 'a' }];
|
|
>a3 : Symbol(a3, Decl(arrayBestCommonTypes.ts, 92, 15))
|
|
>x : Symbol(x, Decl(arrayBestCommonTypes.ts, 92, 23))
|
|
>y : Symbol(y, Decl(arrayBestCommonTypes.ts, 92, 29))
|
|
>x : Symbol(x, Decl(arrayBestCommonTypes.ts, 92, 41))
|
|
>anyObj : Symbol(anyObj, Decl(arrayBestCommonTypes.ts, 88, 15))
|
|
>y : Symbol(y, Decl(arrayBestCommonTypes.ts, 92, 52))
|
|
>x : Symbol(x, Decl(arrayBestCommonTypes.ts, 92, 64))
|
|
>y : Symbol(y, Decl(arrayBestCommonTypes.ts, 92, 72))
|
|
|
|
var ifaceObj: iface = null;
|
|
>ifaceObj : Symbol(ifaceObj, Decl(arrayBestCommonTypes.ts, 94, 15))
|
|
>iface : Symbol(iface, Decl(arrayBestCommonTypes.ts, 53, 22))
|
|
|
|
var baseObj = new base();
|
|
>baseObj : Symbol(baseObj, Decl(arrayBestCommonTypes.ts, 95, 15))
|
|
>base : Symbol(base, Decl(arrayBestCommonTypes.ts, 54, 34))
|
|
|
|
var base2Obj = new base2();
|
|
>base2Obj : Symbol(base2Obj, Decl(arrayBestCommonTypes.ts, 96, 15))
|
|
>base2 : Symbol(base2, Decl(arrayBestCommonTypes.ts, 55, 57))
|
|
|
|
var b1 = [baseObj, base2Obj, ifaceObj];
|
|
>b1 : Symbol(b1, Decl(arrayBestCommonTypes.ts, 98, 15))
|
|
>baseObj : Symbol(baseObj, Decl(arrayBestCommonTypes.ts, 95, 15))
|
|
>base2Obj : Symbol(base2Obj, Decl(arrayBestCommonTypes.ts, 96, 15))
|
|
>ifaceObj : Symbol(ifaceObj, Decl(arrayBestCommonTypes.ts, 94, 15))
|
|
|
|
var b2 = [base2Obj, baseObj, ifaceObj];
|
|
>b2 : Symbol(b2, Decl(arrayBestCommonTypes.ts, 99, 15))
|
|
>base2Obj : Symbol(base2Obj, Decl(arrayBestCommonTypes.ts, 96, 15))
|
|
>baseObj : Symbol(baseObj, Decl(arrayBestCommonTypes.ts, 95, 15))
|
|
>ifaceObj : Symbol(ifaceObj, Decl(arrayBestCommonTypes.ts, 94, 15))
|
|
|
|
var b3 = [baseObj, ifaceObj, base2Obj];
|
|
>b3 : Symbol(b3, Decl(arrayBestCommonTypes.ts, 100, 15))
|
|
>baseObj : Symbol(baseObj, Decl(arrayBestCommonTypes.ts, 95, 15))
|
|
>ifaceObj : Symbol(ifaceObj, Decl(arrayBestCommonTypes.ts, 94, 15))
|
|
>base2Obj : Symbol(base2Obj, Decl(arrayBestCommonTypes.ts, 96, 15))
|
|
|
|
var b4 = [ifaceObj, baseObj, base2Obj];
|
|
>b4 : Symbol(b4, Decl(arrayBestCommonTypes.ts, 101, 15))
|
|
>ifaceObj : Symbol(ifaceObj, Decl(arrayBestCommonTypes.ts, 94, 15))
|
|
>baseObj : Symbol(baseObj, Decl(arrayBestCommonTypes.ts, 95, 15))
|
|
>base2Obj : Symbol(base2Obj, Decl(arrayBestCommonTypes.ts, 96, 15))
|
|
}
|
|
}
|
|
}
|
|
|
|
|