45 lines
1,009 B
Text
45 lines
1,009 B
Text
=== tests/cases/compiler/declarationEmitDestructuringArrayPattern1.ts ===
|
|
|
|
var [] = [1, "hello"]; // Dont emit anything
|
|
>[1, "hello"] : (string | number)[]
|
|
>1 : number
|
|
>"hello" : string
|
|
|
|
var [x] = [1, "hello"]; // emit x: number
|
|
>x : number
|
|
>[1, "hello"] : [number, string]
|
|
>1 : number
|
|
>"hello" : string
|
|
|
|
var [x1, y1] = [1, "hello"]; // emit x1: number, y1: string
|
|
>x1 : number
|
|
>y1 : string
|
|
>[1, "hello"] : [number, string]
|
|
>1 : number
|
|
>"hello" : string
|
|
|
|
var [, , z1] = [0, 1, 2]; // emit z1: number
|
|
> : undefined
|
|
> : undefined
|
|
>z1 : number
|
|
>[0, 1, 2] : [number, number, number]
|
|
>0 : number
|
|
>1 : number
|
|
>2 : number
|
|
|
|
var a = [1, "hello"];
|
|
>a : (string | number)[]
|
|
>[1, "hello"] : (string | number)[]
|
|
>1 : number
|
|
>"hello" : string
|
|
|
|
var [x2] = a; // emit x2: number | string
|
|
>x2 : string | number
|
|
>a : (string | number)[]
|
|
|
|
var [x3, y3, z3] = a; // emit x3, y3, z3
|
|
>x3 : string | number
|
|
>y3 : string | number
|
|
>z3 : string | number
|
|
>a : (string | number)[]
|
|
|