File: interfaceExtendingClassWithPrivates2.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 (51 lines) | stat: -rw-r--r-- 2,451 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
50
51
tests/cases/conformance/interfaces/interfacesExtendingClasses/interfaceExtendingClassWithPrivates2.ts(9,11): error TS2320: Interface 'I3' cannot simultaneously extend types 'Foo' and 'Bar'.
  Named property 'x' of types 'Foo' and 'Bar' are not identical.
tests/cases/conformance/interfaces/interfacesExtendingClasses/interfaceExtendingClassWithPrivates2.ts(12,11): error TS2430: Interface 'I4' incorrectly extends interface 'Bar'.
  Property 'x' is private in type 'Bar' but not in type 'I4'.
tests/cases/conformance/interfaces/interfacesExtendingClasses/interfaceExtendingClassWithPrivates2.ts(12,11): error TS2430: Interface 'I4' incorrectly extends interface 'Foo'.
  Property 'x' is private in type 'Foo' but not in type 'I4'.
tests/cases/conformance/interfaces/interfacesExtendingClasses/interfaceExtendingClassWithPrivates2.ts(26,12): error TS2341: Property 'x' is private and only accessible within class 'Foo'.
tests/cases/conformance/interfaces/interfacesExtendingClasses/interfaceExtendingClassWithPrivates2.ts(27,12): error TS2341: Property 'y' is private and only accessible within class 'Baz'.


==== tests/cases/conformance/interfaces/interfacesExtendingClasses/interfaceExtendingClassWithPrivates2.ts (5 errors) ====
    class Foo {
        private x: string;
    }
    
    class Bar {
        private x: string;
    }
    
    interface I3 extends Foo, Bar { // error
              ~~
!!! error TS2320: Interface 'I3' cannot simultaneously extend types 'Foo' and 'Bar'.
!!! error TS2320:   Named property 'x' of types 'Foo' and 'Bar' are not identical.
    }
    
    interface I4 extends Foo, Bar { // error
              ~~
!!! error TS2430: Interface 'I4' incorrectly extends interface 'Bar'.
!!! error TS2430:   Property 'x' is private in type 'Bar' but not in type 'I4'.
              ~~
!!! error TS2430: Interface 'I4' incorrectly extends interface 'Foo'.
!!! error TS2430:   Property 'x' is private in type 'Foo' but not in type 'I4'.
        x: string;
    }
    
    class Baz {
        private y: string;
    }
    
    interface I5 extends Foo, Baz {
        z: string;
    }
    
    var i: I5;
    var r: string = i.z;
    var r2 = i.x; // error
               ~
!!! error TS2341: Property 'x' is private and only accessible within class 'Foo'.
    var r3 = i.y; // error
               ~
!!! error TS2341: Property 'y' is private and only accessible within class 'Baz'.