File: mergedInterfacesWithInheritedPrivates.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 (42 lines) | stat: -rw-r--r-- 1,609 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
tests/cases/conformance/interfaces/declarationMerging/mergedInterfacesWithInheritedPrivates.ts(13,7): error TS2420: Class 'D' incorrectly implements interface 'A'.
  Types have separate declarations of a private property 'x'.
tests/cases/conformance/interfaces/declarationMerging/mergedInterfacesWithInheritedPrivates.ts(19,7): error TS2420: Class 'E' incorrectly implements interface 'A'.
  Property 'x' is private in type 'A' but not in type 'E'.
tests/cases/conformance/interfaces/declarationMerging/mergedInterfacesWithInheritedPrivates.ts(26,11): error TS2341: Property 'x' is private and only accessible within class 'C'.


==== tests/cases/conformance/interfaces/declarationMerging/mergedInterfacesWithInheritedPrivates.ts (3 errors) ====
    class C {
        private x: number;
    }
    
    interface A extends C {
        y: string;
    }
    
    interface A {
        z: string;
    }
    
    class D implements A { // error
          ~
!!! error TS2420: Class 'D' incorrectly implements interface 'A'.
!!! error TS2420:   Types have separate declarations of a private property 'x'.
        private x: number;
        y: string;
        z: string;
    }
    
    class E implements A { // error
          ~
!!! error TS2420: Class 'E' incorrectly implements interface 'A'.
!!! error TS2420:   Property 'x' is private in type 'A' but not in type 'E'.
        x: number;
        y: string;
        z: string;
    }
    
    var a: A;
    var r = a.x; // error
              ~
!!! error TS2341: Property 'x' is private and only accessible within class 'C'.