File: thisTypeAccessibility.errors.txt

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 (101 lines) | stat: -rw-r--r-- 5,148 bytes parent folder | download | duplicates (4)
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
tests/cases/conformance/types/thisType/thisTypeAccessibility.ts(26,10): error TS2341: Property 'p' is private and only accessible within class 'MyClass'.
tests/cases/conformance/types/thisType/thisTypeAccessibility.ts(29,13): error TS2341: Property 'sp' is private and only accessible within class 'MyClass'.
tests/cases/conformance/types/thisType/thisTypeAccessibility.ts(30,13): error TS2445: Property 'spp' is protected and only accessible within class 'MyClass' and its subclasses.
tests/cases/conformance/types/thisType/thisTypeAccessibility.ts(35,10): error TS2341: Property 'p' is private and only accessible within class 'MyClass'.
tests/cases/conformance/types/thisType/thisTypeAccessibility.ts(38,13): error TS2341: Property 'sp' is private and only accessible within class 'MyClass'.
tests/cases/conformance/types/thisType/thisTypeAccessibility.ts(39,13): error TS2445: Property 'spp' is protected and only accessible within class 'MyClass' and its subclasses.
tests/cases/conformance/types/thisType/thisTypeAccessibility.ts(44,10): error TS2341: Property 'p' is private and only accessible within class 'MyClass'.
tests/cases/conformance/types/thisType/thisTypeAccessibility.ts(47,13): error TS2341: Property 'sp' is private and only accessible within class 'MyClass'.
tests/cases/conformance/types/thisType/thisTypeAccessibility.ts(48,13): error TS2445: Property 'spp' is protected and only accessible within class 'MyClass' and its subclasses.
tests/cases/conformance/types/thisType/thisTypeAccessibility.ts(55,10): error TS2341: Property 'p' is private and only accessible within class 'MyGenericClass<T>'.
tests/cases/conformance/types/thisType/thisTypeAccessibility.ts(58,20): error TS2341: Property 'sp' is private and only accessible within class 'MyGenericClass<T>'.
tests/cases/conformance/types/thisType/thisTypeAccessibility.ts(59,20): error TS2445: Property 'spp' is protected and only accessible within class 'MyGenericClass<T>' and its subclasses.


==== tests/cases/conformance/types/thisType/thisTypeAccessibility.ts (12 errors) ====
    class MyClass {
        private p: number = 123;
        protected pp: number = 123;
        public ppp: number = 123;
        private static sp: number = 123;
        protected static spp: number = 123;
        public static sppp: number = 123;
    }
    
    interface MyClass {
        extension1(p: number): void;
        extension2(p: number): void;
        extension3(p: number): void;
    }
    
    class MyGenericClass<T> {
        private p: T;
        protected pp: T;
        public ppp: T;
        private static sp: number;
        protected static spp: number;
        public static sppp: number;
    }
    
    MyClass.prototype.extension1 = function (this: MyClass, p: number) { 
        this.p = p;
             ~
!!! error TS2341: Property 'p' is private and only accessible within class 'MyClass'.
        this.pp = p;
        this.ppp = p;
        MyClass.sp = p;
                ~~
!!! error TS2341: Property 'sp' is private and only accessible within class 'MyClass'.
        MyClass.spp = p;
                ~~~
!!! error TS2445: Property 'spp' is protected and only accessible within class 'MyClass' and its subclasses.
        MyClass.sppp = p;
    }
    
    MyClass.prototype.extension2 = function<T extends MyClass> (this: T, p: number) { 
        this.p = p;
             ~
!!! error TS2341: Property 'p' is private and only accessible within class 'MyClass'.
        this.pp = p;
        this.ppp = p;
        MyClass.sp = p;
                ~~
!!! error TS2341: Property 'sp' is private and only accessible within class 'MyClass'.
        MyClass.spp = p;
                ~~~
!!! error TS2445: Property 'spp' is protected and only accessible within class 'MyClass' and its subclasses.
        MyClass.sppp = p;
    }
    
    function extension3<T extends MyClass> (this: T, p: number) { 
        this.p = p;
             ~
!!! error TS2341: Property 'p' is private and only accessible within class 'MyClass'.
        this.pp = p;
        this.ppp = p;
        MyClass.sp = p;
                ~~
!!! error TS2341: Property 'sp' is private and only accessible within class 'MyClass'.
        MyClass.spp = p;
                ~~~
!!! error TS2445: Property 'spp' is protected and only accessible within class 'MyClass' and its subclasses.
        MyClass.sppp = p;
    }
    
    MyClass.prototype.extension3 = extension3;
    
    function extension4<T extends number>(this: MyGenericClass<T>, p: T) {
        this.p = p;
             ~
!!! error TS2341: Property 'p' is private and only accessible within class 'MyGenericClass<T>'.
        this.pp = p;
        this.ppp = p;
        MyGenericClass.sp = p;
                       ~~
!!! error TS2341: Property 'sp' is private and only accessible within class 'MyGenericClass<T>'.
        MyGenericClass.spp = p;
                       ~~~
!!! error TS2445: Property 'spp' is protected and only accessible within class 'MyGenericClass<T>' and its subclasses.
        MyGenericClass.sppp = p;
    }