File: privateWriteOnlyAccessorRead.types

package info (click to toggle)
node-typescript 5.0.4%2Bds1-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 459,140 kB
  • sloc: javascript: 1,972,754; makefile: 6; sh: 1
file content (160 lines) | stat: -rw-r--r-- 4,523 bytes parent folder | download | duplicates (3)
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
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
=== tests/cases/conformance/classes/members/privateNames/privateWriteOnlyAccessorRead.ts ===
class Test {
>Test : Test

  set #value(v: { foo: { bar: number } }) {}
>#value : { foo: {    bar: number;}; }
>v : { foo: {    bar: number;}; }
>foo : { bar: number; }
>bar : number

  set #valueRest(v: number[]) {}
>#valueRest : number[]
>v : number[]

  set #valueOne(v: number) {}
>#valueOne : number
>v : number

  set #valueCompound(v: number) {}
>#valueCompound : number
>v : number

  m() {
>m : () => void

    const foo = { bar: 1 };
>foo : { bar: number; }
>{ bar: 1 } : { bar: number; }
>bar : number
>1 : 1

    console.log(this.#value); // error
>console.log(this.#value) : void
>console.log : (...data: any[]) => void
>console : Console
>log : (...data: any[]) => void
>this.#value : { foo: { bar: number; }; }
>this : this

    this.#value = { foo }; // ok
>this.#value = { foo } : { foo: { bar: number; }; }
>this.#value : { foo: { bar: number; }; }
>this : this
>{ foo } : { foo: { bar: number; }; }
>foo : { bar: number; }

    this.#value = { foo }; // ok
>this.#value = { foo } : { foo: { bar: number; }; }
>this.#value : { foo: { bar: number; }; }
>this : this
>{ foo } : { foo: { bar: number; }; }
>foo : { bar: number; }

    this.#value.foo = foo; // error
>this.#value.foo = foo : { bar: number; }
>this.#value.foo : { bar: number; }
>this.#value : { foo: { bar: number; }; }
>this : this
>foo : { bar: number; }
>foo : { bar: number; }

    ({ o: this.#value } = { o: { foo } }); //ok
>({ o: this.#value } = { o: { foo } }) : { o: { foo: { bar: number; }; }; }
>{ o: this.#value } = { o: { foo } } : { o: { foo: { bar: number; }; }; }
>{ o: this.#value } : { o: { foo: { bar: number; }; }; }
>o : { foo: { bar: number; }; }
>this.#value : { foo: { bar: number; }; }
>this : this
>{ o: { foo } } : { o: { foo: { bar: number; }; }; }
>o : { foo: { bar: number; }; }
>{ foo } : { foo: { bar: number; }; }
>foo : { bar: number; }

    ({ ...this.#value } = { foo }); //ok
>({ ...this.#value } = { foo }) : { foo: { bar: number; }; }
>{ ...this.#value } = { foo } : { foo: { bar: number; }; }
>{ ...this.#value } : { foo: { bar: number; }; }
>this.#value : { foo: { bar: number; }; }
>this : this
>{ foo } : { foo: { bar: number; }; }
>foo : { bar: number; }

    ({ foo: this.#value.foo } = { foo }); //error
>({ foo: this.#value.foo } = { foo }) : { foo: { bar: number; }; }
>{ foo: this.#value.foo } = { foo } : { foo: { bar: number; }; }
>{ foo: this.#value.foo } : { foo: { bar: number; }; }
>foo : { bar: number; }
>this.#value.foo : { bar: number; }
>this.#value : { foo: { bar: number; }; }
>this : this
>foo : { bar: number; }
>{ foo } : { foo: { bar: number; }; }
>foo : { bar: number; }

    ({
>({      foo: { ...this.#value.foo },    } = { foo }) : { foo: { bar: number; }; }
>{      foo: { ...this.#value.foo },    } = { foo } : { foo: { bar: number; }; }
>{      foo: { ...this.#value.foo },    } : { foo: { bar: number; }; }

      foo: { ...this.#value.foo },
>foo : { bar: number; }
>{ ...this.#value.foo } : { bar: number; }
>this.#value.foo : { bar: number; }
>this.#value : { foo: { bar: number; }; }
>this : this
>foo : { bar: number; }

    } = { foo }); //error
>{ foo } : { foo: { bar: number; }; }
>foo : { bar: number; }

    let r = { o: this.#value }; //error
>r : { o: { foo: { bar: number; }; }; }
>{ o: this.#value } : { o: { foo: { bar: number; }; }; }
>o : { foo: { bar: number; }; }
>this.#value : { foo: { bar: number; }; }
>this : this

    [this.#valueOne, ...this.#valueRest] = [1, 2, 3];
>[this.#valueOne, ...this.#valueRest] = [1, 2, 3] : [number, number, number]
>[this.#valueOne, ...this.#valueRest] : [number, ...number[]]
>this.#valueOne : number
>this : this
>...this.#valueRest : number
>this.#valueRest : number[]
>this : this
>[1, 2, 3] : [number, number, number]
>1 : 1
>2 : 2
>3 : 3

    let arr = [
>arr : number[]
>[        this.#valueOne,        ...this.#valueRest    ] : number[]

        this.#valueOne,
>this.#valueOne : number
>this : this

        ...this.#valueRest
>...this.#valueRest : number
>this.#valueRest : number[]
>this : this

    ];

    this.#valueCompound += 3;
>this.#valueCompound += 3 : number
>this.#valueCompound : number
>this : this
>3 : 3
  }
}
new Test().m();
>new Test().m() : void
>new Test().m : () => void
>new Test() : Test
>Test : typeof Test
>m : () => void