TypeScript/tests/baselines/reference/arrayLiteral.types

56 lines
2.1 KiB
Text
Raw Normal View History

2014-08-15 23:33:16 +02:00
=== tests/cases/conformance/types/specifyingTypes/typeLiterals/arrayLiteral.ts ===
// valid uses of array literals
var x = [];
2015-04-13 23:01:57 +02:00
>x : any[], Symbol(x, Decl(arrayLiteral.ts, 2, 3), Decl(arrayLiteral.ts, 3, 3))
2014-08-15 23:33:16 +02:00
>[] : undefined[]
var x = new Array(1);
2015-04-13 23:01:57 +02:00
>x : any[], Symbol(x, Decl(arrayLiteral.ts, 2, 3), Decl(arrayLiteral.ts, 3, 3))
2014-08-15 23:33:16 +02:00
>new Array(1) : any[]
2015-04-13 23:01:57 +02:00
>Array : ArrayConstructor, Symbol(Array, Decl(lib.d.ts, 1000, 23), Decl(lib.d.ts, 1171, 11))
2015-04-13 21:36:11 +02:00
>1 : number
2014-08-15 23:33:16 +02:00
var y = [1];
2015-04-13 23:01:57 +02:00
>y : number[], Symbol(y, Decl(arrayLiteral.ts, 5, 3), Decl(arrayLiteral.ts, 6, 3), Decl(arrayLiteral.ts, 7, 3))
2014-08-15 23:33:16 +02:00
>[1] : number[]
2015-04-13 21:36:11 +02:00
>1 : number
2014-08-15 23:33:16 +02:00
var y = [1, 2];
2015-04-13 23:01:57 +02:00
>y : number[], Symbol(y, Decl(arrayLiteral.ts, 5, 3), Decl(arrayLiteral.ts, 6, 3), Decl(arrayLiteral.ts, 7, 3))
2014-08-15 23:33:16 +02:00
>[1, 2] : number[]
2015-04-13 21:36:11 +02:00
>1 : number
>2 : number
2014-08-15 23:33:16 +02:00
var y = new Array<number>();
2015-04-13 23:01:57 +02:00
>y : number[], Symbol(y, Decl(arrayLiteral.ts, 5, 3), Decl(arrayLiteral.ts, 6, 3), Decl(arrayLiteral.ts, 7, 3))
2014-08-15 23:33:16 +02:00
>new Array<number>() : number[]
2015-04-13 23:01:57 +02:00
>Array : ArrayConstructor, Symbol(Array, Decl(lib.d.ts, 1000, 23), Decl(lib.d.ts, 1171, 11))
2014-08-15 23:33:16 +02:00
var x2: number[] = [];
2015-04-13 23:01:57 +02:00
>x2 : number[], Symbol(x2, Decl(arrayLiteral.ts, 9, 3), Decl(arrayLiteral.ts, 10, 3))
2014-10-13 15:56:58 +02:00
>[] : undefined[]
2014-08-15 23:33:16 +02:00
var x2: number[] = new Array(1);
2015-04-13 23:01:57 +02:00
>x2 : number[], Symbol(x2, Decl(arrayLiteral.ts, 9, 3), Decl(arrayLiteral.ts, 10, 3))
2014-08-15 23:33:16 +02:00
>new Array(1) : any[]
2015-04-13 23:01:57 +02:00
>Array : ArrayConstructor, Symbol(Array, Decl(lib.d.ts, 1000, 23), Decl(lib.d.ts, 1171, 11))
2015-04-13 21:36:11 +02:00
>1 : number
2014-08-15 23:33:16 +02:00
var y2: number[] = [1];
2015-04-13 23:01:57 +02:00
>y2 : number[], Symbol(y2, Decl(arrayLiteral.ts, 12, 3), Decl(arrayLiteral.ts, 13, 3), Decl(arrayLiteral.ts, 14, 3))
2014-08-15 23:33:16 +02:00
>[1] : number[]
2015-04-13 21:36:11 +02:00
>1 : number
2014-08-15 23:33:16 +02:00
var y2: number[] = [1, 2];
2015-04-13 23:01:57 +02:00
>y2 : number[], Symbol(y2, Decl(arrayLiteral.ts, 12, 3), Decl(arrayLiteral.ts, 13, 3), Decl(arrayLiteral.ts, 14, 3))
2014-08-15 23:33:16 +02:00
>[1, 2] : number[]
2015-04-13 21:36:11 +02:00
>1 : number
>2 : number
2014-08-15 23:33:16 +02:00
var y2: number[] = new Array<number>();
2015-04-13 23:01:57 +02:00
>y2 : number[], Symbol(y2, Decl(arrayLiteral.ts, 12, 3), Decl(arrayLiteral.ts, 13, 3), Decl(arrayLiteral.ts, 14, 3))
2014-08-15 23:33:16 +02:00
>new Array<number>() : number[]
2015-04-13 23:01:57 +02:00
>Array : ArrayConstructor, Symbol(Array, Decl(lib.d.ts, 1000, 23), Decl(lib.d.ts, 1171, 11))
2014-08-15 23:33:16 +02:00