87 lines
3.4 KiB
Text
87 lines
3.4 KiB
Text
=== 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 : { x: number; y?: number; }
|
|
>x : number
|
|
>y : number
|
|
|
|
var b: { x: number; z?: number };
|
|
>b : { x: number; z?: number; }
|
|
>x : number
|
|
>z : number
|
|
|
|
var c: { x: number; a?: number };
|
|
>c : { x: number; a?: number; }
|
|
>x : number
|
|
>a : number
|
|
|
|
var as = [a, b]; // { x: number; y?: number };[]
|
|
>as : ({ x: number; y?: number; } | { x: number; z?: number; })[]
|
|
>[a, b] : ({ x: number; y?: number; } | { x: number; z?: number; })[]
|
|
>a : { x: number; y?: number; }
|
|
>b : { x: number; z?: number; }
|
|
|
|
var bs = [b, a]; // { x: number; z?: number };[]
|
|
>bs : ({ x: number; y?: number; } | { x: number; z?: number; })[]
|
|
>[b, a] : ({ x: number; y?: number; } | { x: number; z?: number; })[]
|
|
>b : { x: number; z?: number; }
|
|
>a : { x: number; y?: number; }
|
|
|
|
var cs = [a, b, c]; // { x: number; y?: number };[]
|
|
>cs : ({ x: number; y?: number; } | { x: number; z?: number; } | { x: number; a?: number; })[]
|
|
>[a, b, c] : ({ x: number; y?: number; } | { x: number; z?: number; } | { x: number; a?: number; })[]
|
|
>a : { x: number; y?: number; }
|
|
>b : { x: number; z?: number; }
|
|
>c : { x: number; a?: number; }
|
|
|
|
var ds = [(x: Object) => 1, (x: string) => 2]; // { (x:Object) => number }[]
|
|
>ds : ((x: Object) => number)[]
|
|
>[(x: Object) => 1, (x: string) => 2] : ((x: Object) => number)[]
|
|
>(x: Object) => 1 : (x: Object) => number
|
|
>x : Object
|
|
>Object : Object
|
|
>1 : number
|
|
>(x: string) => 2 : (x: string) => number
|
|
>x : string
|
|
>2 : number
|
|
|
|
var es = [(x: string) => 2, (x: Object) => 1]; // { (x:string) => number }[]
|
|
>es : ((x: string) => number)[]
|
|
>[(x: string) => 2, (x: Object) => 1] : ((x: string) => number)[]
|
|
>(x: string) => 2 : (x: string) => number
|
|
>x : string
|
|
>2 : number
|
|
>(x: Object) => 1 : (x: Object) => number
|
|
>x : Object
|
|
>Object : Object
|
|
>1 : number
|
|
|
|
var fs = [(a: { x: number; y?: number }) => 1, (b: { x: number; z?: number }) => 2]; // (a: { x: number; y?: number }) => number[]
|
|
>fs : (((a: { x: number; y?: number; }) => number) | ((b: { x: number; z?: number; }) => number))[]
|
|
>[(a: { x: number; y?: number }) => 1, (b: { x: number; z?: number }) => 2] : (((a: { x: number; y?: number; }) => number) | ((b: { x: number; z?: number; }) => number))[]
|
|
>(a: { x: number; y?: number }) => 1 : (a: { x: number; y?: number; }) => number
|
|
>a : { x: number; y?: number; }
|
|
>x : number
|
|
>y : number
|
|
>1 : number
|
|
>(b: { x: number; z?: number }) => 2 : (b: { x: number; z?: number; }) => number
|
|
>b : { x: number; z?: number; }
|
|
>x : number
|
|
>z : number
|
|
>2 : number
|
|
|
|
var gs = [(b: { x: number; z?: number }) => 2, (a: { x: number; y?: number }) => 1]; // (b: { x: number; z?: number }) => number[]
|
|
>gs : (((b: { x: number; z?: number; }) => number) | ((a: { x: number; y?: number; }) => number))[]
|
|
>[(b: { x: number; z?: number }) => 2, (a: { x: number; y?: number }) => 1] : (((b: { x: number; z?: number; }) => number) | ((a: { x: number; y?: number; }) => number))[]
|
|
>(b: { x: number; z?: number }) => 2 : (b: { x: number; z?: number; }) => number
|
|
>b : { x: number; z?: number; }
|
|
>x : number
|
|
>z : number
|
|
>2 : number
|
|
>(a: { x: number; y?: number }) => 1 : (a: { x: number; y?: number; }) => number
|
|
>a : { x: number; y?: number; }
|
|
>x : number
|
|
>y : number
|
|
>1 : number
|
|
|