2014-08-15 23:33:16 +02:00
|
|
|
=== tests/cases/conformance/types/specifyingTypes/typeLiterals/arrayLiteral.ts ===
|
|
|
|
// valid uses of array literals
|
|
|
|
|
|
|
|
var x = [];
|
|
|
|
>x : any[]
|
|
|
|
>[] : undefined[]
|
|
|
|
|
|
|
|
var x = new Array(1);
|
|
|
|
>x : any[]
|
|
|
|
>new Array(1) : any[]
|
2014-10-29 05:21:47 +01:00
|
|
|
>Array : ArrayConstructor
|
2014-08-15 23:33:16 +02:00
|
|
|
|
|
|
|
var y = [1];
|
|
|
|
>y : number[]
|
|
|
|
>[1] : number[]
|
|
|
|
|
|
|
|
var y = [1, 2];
|
|
|
|
>y : number[]
|
|
|
|
>[1, 2] : number[]
|
|
|
|
|
|
|
|
var y = new Array<number>();
|
|
|
|
>y : number[]
|
|
|
|
>new Array<number>() : number[]
|
2014-10-29 05:21:47 +01:00
|
|
|
>Array : ArrayConstructor
|
2014-08-15 23:33:16 +02:00
|
|
|
|
|
|
|
var x2: number[] = [];
|
|
|
|
>x2 : number[]
|
2014-10-13 15:56:58 +02:00
|
|
|
>[] : undefined[]
|
2014-08-15 23:33:16 +02:00
|
|
|
|
|
|
|
var x2: number[] = new Array(1);
|
|
|
|
>x2 : number[]
|
|
|
|
>new Array(1) : any[]
|
2014-10-29 05:21:47 +01:00
|
|
|
>Array : ArrayConstructor
|
2014-08-15 23:33:16 +02:00
|
|
|
|
|
|
|
var y2: number[] = [1];
|
|
|
|
>y2 : number[]
|
|
|
|
>[1] : number[]
|
|
|
|
|
|
|
|
var y2: number[] = [1, 2];
|
|
|
|
>y2 : number[]
|
|
|
|
>[1, 2] : number[]
|
|
|
|
|
|
|
|
var y2: number[] = new Array<number>();
|
|
|
|
>y2 : number[]
|
|
|
|
>new Array<number>() : number[]
|
2014-10-29 05:21:47 +01:00
|
|
|
>Array : ArrayConstructor
|
2014-08-15 23:33:16 +02:00
|
|
|
|