File: destructuringArrayBindingPatternAndAssignment3.types

package info (click to toggle)
node-typescript 3.3.3333-1
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 324,548 kB
  • sloc: makefile: 6; sh: 3
file content (70 lines) | stat: -rw-r--r-- 1,634 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
=== tests/cases/conformance/es6/destructuring/destructuringArrayBindingPatternAndAssignment3.ts ===
const [a, b = a] = [1]; // ok
>a : any
>b : any
>a : any
>[1] : [number, any?]
>1 : 1

const [c, d = c, e = e] = [1]; // error for e = e
>c : any
>d : any
>c : any
>e : any
>e : any
>[1] : [number, any?, any?]
>1 : 1

const [f, g = f, h = i, i = f] = [1]; // error for h = i
>f : any
>g : any
>f : any
>h : any
>i : any
>i : any
>f : any
>[1] : [number, any?, any?, any?]
>1 : 1

(function ([a, b = a]) { // ok
>(function ([a, b = a]) { // ok})([1]) : void
>(function ([a, b = a]) { // ok}) : ([a, b]: number[]) => void
>function ([a, b = a]) { // ok} : ([a, b]: number[]) => void
>a : number
>b : number
>a : number

})([1]);
>[1] : number[]
>1 : 1

(function ([c, d = c, e = e]) { // error for e = e
>(function ([c, d = c, e = e]) { // error for e = e})([1]) : void
>(function ([c, d = c, e = e]) { // error for e = e}) : ([c, d, e]: number[]) => void
>function ([c, d = c, e = e]) { // error for e = e} : ([c, d, e]: number[]) => void
>c : number
>d : number
>c : number
>e : any
>e : any

})([1]);
>[1] : number[]
>1 : 1

(function ([f, g = f, h = i, i = f]) { // error for h = i
>(function ([f, g = f, h = i, i = f]) { // error for h = i})([1]) : void
>(function ([f, g = f, h = i, i = f]) { // error for h = i}) : ([f, g, h, i]: number[]) => void
>function ([f, g = f, h = i, i = f]) { // error for h = i} : ([f, g, h, i]: number[]) => void
>f : number
>g : number
>f : number
>h : number
>i : number
>i : number
>f : number

})([1])
>[1] : number[]
>1 : 1