/
destructuringParameterDeclaration6.types
75 lines (61 loc) · 1.55 KB
/
destructuringParameterDeclaration6.types
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
71
72
73
74
75
=== tests/cases/conformance/es6/destructuring/destructuringParameterDeclaration6.ts ===
// A parameter declaration may specify either an identifier or a binding pattern.
// Reserved words are not allowed to be used as an identifier in parameter declaration
"use strict"
>"use strict" : "use strict"
// Error
function a({while}) { }
>a : ({ while: }: { while: any; }) => void
>while : any
> : any
function a1({public}) { }
>a1 : ({ public }: { public: any; }) => void
>public : any
function a4([while, for, public]){ }
>a4 : ([]: any[]) => any
>, : any
> : any
> : any
>, public : any
> : any
>public : any
> : any
> : any
> : any
function a5(...while) { }
>a5 : (...: any[]) => any
> : any[]
> : any
function a6(...public) { }
>a6 : (...public: any[]) => void
>public : any[]
function a7(...a: string) { }
>a7 : (...a: string) => void
>a : string
a({ while: 1 });
>a({ while: 1 }) : void
>a : ({ while: }: { while: any; }) => void
>{ while: 1 } : { while: number; }
>while : number
>1 : 1
// No Error
function b1({public: x}) { }
>b1 : ({ public: x }: { public: any; }) => void
>public : any
>x : any
function b2({while: y}) { }
>b2 : ({ while: y }: { while: any; }) => void
>while : any
>y : any
b1({ public: 1 });
>b1({ public: 1 }) : void
>b1 : ({ public: x }: { public: any; }) => void
>{ public: 1 } : { public: number; }
>public : number
>1 : 1
b2({ while: 1 });
>b2({ while: 1 }) : void
>b2 : ({ while: y }: { while: any; }) => void
>{ while: 1 } : { while: number; }
>while : number
>1 : 1