File: classWithPrivateProperty.errors.txt

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 (49 lines) | stat: -rw-r--r-- 2,745 bytes parent folder | download | duplicates (7)
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
tests/cases/conformance/types/members/classWithPrivateProperty.ts(15,20): error TS2341: Property 'x' is private and only accessible within class 'C'.
tests/cases/conformance/types/members/classWithPrivateProperty.ts(16,20): error TS2341: Property 'a' is private and only accessible within class 'C'.
tests/cases/conformance/types/members/classWithPrivateProperty.ts(17,20): error TS2341: Property 'b' is private and only accessible within class 'C'.
tests/cases/conformance/types/members/classWithPrivateProperty.ts(18,20): error TS2341: Property 'c' is private and only accessible within class 'C'.
tests/cases/conformance/types/members/classWithPrivateProperty.ts(19,20): error TS2341: Property 'd' is private and only accessible within class 'C'.
tests/cases/conformance/types/members/classWithPrivateProperty.ts(20,20): error TS2341: Property 'e' is private and only accessible within class 'C'.
tests/cases/conformance/types/members/classWithPrivateProperty.ts(21,20): error TS2341: Property 'f' is private and only accessible within class 'C'.
tests/cases/conformance/types/members/classWithPrivateProperty.ts(22,20): error TS2341: Property 'g' is private and only accessible within class 'C'.


==== tests/cases/conformance/types/members/classWithPrivateProperty.ts (8 errors) ====
    // accessing any private outside the class is an error
    
    class C {
        private x;
        private a = '';
        private b: string = '';
        private c() { return '' }
        private d = () => '';
        private static e;
        private static f() { return '' }
        private static g = () => '';
    }
    
    var c = new C();
    var r1: string = c.x;
                       ~
!!! error TS2341: Property 'x' is private and only accessible within class 'C'.
    var r2: string = c.a;
                       ~
!!! error TS2341: Property 'a' is private and only accessible within class 'C'.
    var r3: string = c.b;
                       ~
!!! error TS2341: Property 'b' is private and only accessible within class 'C'.
    var r4: string = c.c();
                       ~
!!! error TS2341: Property 'c' is private and only accessible within class 'C'.
    var r5: string = c.d();
                       ~
!!! error TS2341: Property 'd' is private and only accessible within class 'C'.
    var r6: string = C.e;
                       ~
!!! error TS2341: Property 'e' is private and only accessible within class 'C'.
    var r7: string = C.f();
                       ~
!!! error TS2341: Property 'f' is private and only accessible within class 'C'.
    var r8: string = C.g();
                       ~
!!! error TS2341: Property 'g' is private and only accessible within class 'C'.