File: privateNamesIncompatibleModifiers.types

package info (click to toggle)
node-typescript 4.9.5%2Bds1-2
  • links: PTS, VCS
  • area: main
  • in suites: sid, trixie
  • size: 533,908 kB
  • sloc: javascript: 2,018,330; makefile: 7; sh: 1
file content (110 lines) | stat: -rw-r--r-- 2,429 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
=== tests/cases/conformance/classes/members/privateNames/privateNamesIncompatibleModifiers.ts ===
class A {
>A : A

    public #foo = 3;         // Error
>#foo : number
>3 : 3

    private #bar = 3;        // Error
>#bar : number
>3 : 3

    protected #baz = 3;      // Error
>#baz : number
>3 : 3

    readonly #qux = 3;       // OK
>#qux : 3
>3 : 3

    declare #what: number;   // Error
>#what : number

    public #fooMethod() { return  3; }         // Error
>#fooMethod : () => number
>3 : 3

    private #barMethod() { return  3; }        // Error
>#barMethod : () => number
>3 : 3

    protected #bazMethod() { return  3; }      // Error
>#bazMethod : () => number
>3 : 3

    readonly #quxMethod() { return  3; }       // Error
>#quxMethod : () => number
>3 : 3

    declare #whatMethod()                      // Error
>#whatMethod : () => any

    async #asyncMethod() { return 1; }         //OK
>#asyncMethod : () => Promise<number>
>1 : 1

    *#genMethod() { return 1; }                //OK
>#genMethod : () => Generator<never, number, unknown>
>1 : 1

    async *#asyncGenMethod() { return 1; }     //OK
>#asyncGenMethod : () => {}
>1 : 1

    public get #fooProp() { return  3; }         // Error
>#fooProp : number
>3 : 3

    public set #fooProp(value: number) {  }      // Error
>#fooProp : number
>value : number

    private get #barProp() { return  3; }        // Error
>#barProp : number
>3 : 3

    private set #barProp(value: number) {  }     // Error
>#barProp : number
>value : number

    protected get #bazProp() { return  3; }      // Error
>#bazProp : number
>3 : 3

    protected set #bazProp(value: number) {  }   // Error
>#bazProp : number
>value : number

    readonly get #quxProp() { return  3; }       // Error
>#quxProp : number
>3 : 3

    readonly set #quxProp(value: number) {  }    // Error
>#quxProp : number
>value : number

    declare get #whatProp()                      // Error
>#whatProp : number

    declare set #whatProp(value: number)         // Error
>#whatProp : number
>value : number

    async get #asyncProp() { return 1; }         // Error
>#asyncProp : number
>1 : 1

    async set #asyncProp(value: number) { }      // Error
>#asyncProp : number
>value : number
}

abstract class B {
>B : B

    abstract #quux = 3;      // Error
>#quux : number
>3 : 3
}