55 lines
1.2 KiB
Text
55 lines
1.2 KiB
Text
=== tests/cases/conformance/types/typeRelationships/widenedTypes/arrayLiteralWidened.ts ===
|
|
// array literals are widened upon assignment according to their element type
|
|
|
|
var a = []; // any[]
|
|
>a : any[]
|
|
>[] : undefined[]
|
|
|
|
var a = [null, null];
|
|
>a : any[]
|
|
>[null, null] : null[]
|
|
>null : null
|
|
>null : null
|
|
|
|
var a = [undefined, undefined];
|
|
>a : any[]
|
|
>[undefined, undefined] : undefined[]
|
|
>undefined : undefined
|
|
>undefined : undefined
|
|
|
|
var b = [[], [null, null]]; // any[][]
|
|
>b : any[][]
|
|
>[[], [null, null]] : null[][]
|
|
>[] : undefined[]
|
|
>[null, null] : null[]
|
|
>null : null
|
|
>null : null
|
|
|
|
var b = [[], []];
|
|
>b : any[][]
|
|
>[[], []] : undefined[][]
|
|
>[] : undefined[]
|
|
>[] : undefined[]
|
|
|
|
var b = [[undefined, undefined]];
|
|
>b : any[][]
|
|
>[[undefined, undefined]] : undefined[][]
|
|
>[undefined, undefined] : undefined[]
|
|
>undefined : undefined
|
|
>undefined : undefined
|
|
|
|
var c = [[[]]]; // any[][][]
|
|
>c : any[][][]
|
|
>[[[]]] : undefined[][][]
|
|
>[[]] : undefined[][]
|
|
>[] : undefined[]
|
|
|
|
var c = [[[null]],[undefined]]
|
|
>c : any[][][]
|
|
>[[[null]],[undefined]] : null[][][]
|
|
>[[null]] : null[][]
|
|
>[null] : null[]
|
|
>null : null
|
|
>[undefined] : undefined[]
|
|
>undefined : undefined
|
|
|