| 12
 3
 4
 5
 6
 7
 8
 9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 
 | === tests/cases/conformance/types/typeRelationships/bestCommonType/arrayLiteralWithMultipleBestCommonTypes.ts ===
// when multiple best common types exist we will choose the first candidate
var a: { x: number; y?: number };
>a : Symbol(a, Decl(arrayLiteralWithMultipleBestCommonTypes.ts, 2, 3))
>x : Symbol(x, Decl(arrayLiteralWithMultipleBestCommonTypes.ts, 2, 8))
>y : Symbol(y, Decl(arrayLiteralWithMultipleBestCommonTypes.ts, 2, 19))
var b: { x: number; z?: number };
>b : Symbol(b, Decl(arrayLiteralWithMultipleBestCommonTypes.ts, 3, 3))
>x : Symbol(x, Decl(arrayLiteralWithMultipleBestCommonTypes.ts, 3, 8))
>z : Symbol(z, Decl(arrayLiteralWithMultipleBestCommonTypes.ts, 3, 19))
var c: { x: number; a?: number };
>c : Symbol(c, Decl(arrayLiteralWithMultipleBestCommonTypes.ts, 4, 3))
>x : Symbol(x, Decl(arrayLiteralWithMultipleBestCommonTypes.ts, 4, 8))
>a : Symbol(a, Decl(arrayLiteralWithMultipleBestCommonTypes.ts, 4, 19))
var as = [a, b]; // { x: number; y?: number };[]
>as : Symbol(as, Decl(arrayLiteralWithMultipleBestCommonTypes.ts, 6, 3))
>a : Symbol(a, Decl(arrayLiteralWithMultipleBestCommonTypes.ts, 2, 3))
>b : Symbol(b, Decl(arrayLiteralWithMultipleBestCommonTypes.ts, 3, 3))
var bs = [b, a]; // { x: number; z?: number };[]
>bs : Symbol(bs, Decl(arrayLiteralWithMultipleBestCommonTypes.ts, 7, 3))
>b : Symbol(b, Decl(arrayLiteralWithMultipleBestCommonTypes.ts, 3, 3))
>a : Symbol(a, Decl(arrayLiteralWithMultipleBestCommonTypes.ts, 2, 3))
var cs = [a, b, c]; // { x: number; y?: number };[]
>cs : Symbol(cs, Decl(arrayLiteralWithMultipleBestCommonTypes.ts, 8, 3))
>a : Symbol(a, Decl(arrayLiteralWithMultipleBestCommonTypes.ts, 2, 3))
>b : Symbol(b, Decl(arrayLiteralWithMultipleBestCommonTypes.ts, 3, 3))
>c : Symbol(c, Decl(arrayLiteralWithMultipleBestCommonTypes.ts, 4, 3))
var ds = [(x: Object) => 1, (x: string) => 2]; // { (x:Object) => number }[]
>ds : Symbol(ds, Decl(arrayLiteralWithMultipleBestCommonTypes.ts, 10, 3))
>x : Symbol(x, Decl(arrayLiteralWithMultipleBestCommonTypes.ts, 10, 11))
>Object : Symbol(Object, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --))
>x : Symbol(x, Decl(arrayLiteralWithMultipleBestCommonTypes.ts, 10, 29))
var es = [(x: string) => 2, (x: Object) => 1]; // { (x:string) => number }[]
>es : Symbol(es, Decl(arrayLiteralWithMultipleBestCommonTypes.ts, 11, 3))
>x : Symbol(x, Decl(arrayLiteralWithMultipleBestCommonTypes.ts, 11, 11))
>x : Symbol(x, Decl(arrayLiteralWithMultipleBestCommonTypes.ts, 11, 29))
>Object : Symbol(Object, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --))
var fs = [(a: { x: number; y?: number }) => 1, (b: { x: number; z?: number }) => 2]; // (a: { x: number; y?: number }) => number[]
>fs : Symbol(fs, Decl(arrayLiteralWithMultipleBestCommonTypes.ts, 12, 3))
>a : Symbol(a, Decl(arrayLiteralWithMultipleBestCommonTypes.ts, 12, 11))
>x : Symbol(x, Decl(arrayLiteralWithMultipleBestCommonTypes.ts, 12, 15))
>y : Symbol(y, Decl(arrayLiteralWithMultipleBestCommonTypes.ts, 12, 26))
>b : Symbol(b, Decl(arrayLiteralWithMultipleBestCommonTypes.ts, 12, 48))
>x : Symbol(x, Decl(arrayLiteralWithMultipleBestCommonTypes.ts, 12, 52))
>z : Symbol(z, Decl(arrayLiteralWithMultipleBestCommonTypes.ts, 12, 63))
var gs = [(b: { x: number; z?: number }) => 2, (a: { x: number; y?: number }) => 1]; // (b: { x: number; z?: number }) => number[]
>gs : Symbol(gs, Decl(arrayLiteralWithMultipleBestCommonTypes.ts, 13, 3))
>b : Symbol(b, Decl(arrayLiteralWithMultipleBestCommonTypes.ts, 13, 11))
>x : Symbol(x, Decl(arrayLiteralWithMultipleBestCommonTypes.ts, 13, 15))
>z : Symbol(z, Decl(arrayLiteralWithMultipleBestCommonTypes.ts, 13, 26))
>a : Symbol(a, Decl(arrayLiteralWithMultipleBestCommonTypes.ts, 13, 48))
>x : Symbol(x, Decl(arrayLiteralWithMultipleBestCommonTypes.ts, 13, 52))
>y : Symbol(y, Decl(arrayLiteralWithMultipleBestCommonTypes.ts, 13, 63))
 |