File: classStaticPropertyAccess.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 (28 lines) | stat: -rw-r--r-- 1,127 bytes parent folder | download
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
tests/cases/compiler/classStaticPropertyAccess.ts(9,1): error TS2576: Property 'y' is a static member of type 'A'
tests/cases/compiler/classStaticPropertyAccess.ts(10,3): error TS2576: Property 'y' is a static member of type 'A'
tests/cases/compiler/classStaticPropertyAccess.ts(11,3): error TS2341: Property '_b' is private and only accessible within class 'A'.
tests/cases/compiler/classStaticPropertyAccess.ts(12,3): error TS2339: Property 'a' does not exist on type 'typeof A'.


==== tests/cases/compiler/classStaticPropertyAccess.ts (4 errors) ====
    class A {
        public static x: number = 1;
        public static y: number = 1;
        private static _b: number = 2;
    }
    
    const a = new A();
    
    a['y'] // Error
    ~~~~~~
!!! error TS2576: Property 'y' is a static member of type 'A'
    a.y    // Error
      ~
!!! error TS2576: Property 'y' is a static member of type 'A'
    A._b   // Error
      ~~
!!! error TS2341: Property '_b' is private and only accessible within class 'A'.
    A.a
      ~
!!! error TS2339: Property 'a' does not exist on type 'typeof A'.