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
|
tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingWithObjectMembersAccessibility2.ts(16,11): error TS2415: Class 'B' incorrectly extends base class 'A'.
Property 'foo' is private in type 'A' but not in type 'B'.
tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingWithObjectMembersAccessibility2.ts(24,11): error TS2415: Class 'B2' incorrectly extends base class 'A2'.
Property '1' is private in type 'A2' but not in type 'B2'.
tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingWithObjectMembersAccessibility2.ts(32,11): error TS2415: Class 'B3' incorrectly extends base class 'A3'.
Property ''1'' is private in type 'A3' but not in type 'B3'.
tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingWithObjectMembersAccessibility2.ts(42,11): error TS2415: Class 'B' incorrectly extends base class 'A'.
Property 'foo' is private in type 'A' but not in type 'B'.
tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingWithObjectMembersAccessibility2.ts(50,11): error TS2415: Class 'B2' incorrectly extends base class 'A2'.
Property '1' is private in type 'A2' but not in type 'B2'.
tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingWithObjectMembersAccessibility2.ts(58,11): error TS2415: Class 'B3' incorrectly extends base class 'A3'.
Property ''1'' is private in type 'A3' but not in type 'B3'.
==== tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingWithObjectMembersAccessibility2.ts (6 errors) ====
// Derived member is private, base member is not causes errors
class Base {
foo: string;
}
class Derived extends Base {
bar: string;
}
module ExplicitPublic {
class A {
private foo: Base;
}
class B extends A {
~
!!! error TS2415: Class 'B' incorrectly extends base class 'A'.
!!! error TS2415: Property 'foo' is private in type 'A' but not in type 'B'.
public foo: Derived; // error
}
class A2 {
private 1: Base;
}
class B2 extends A2 {
~~
!!! error TS2415: Class 'B2' incorrectly extends base class 'A2'.
!!! error TS2415: Property '1' is private in type 'A2' but not in type 'B2'.
public 1: Derived; // error
}
class A3 {
private '1': Base;
}
class B3 extends A3 {
~~
!!! error TS2415: Class 'B3' incorrectly extends base class 'A3'.
!!! error TS2415: Property ''1'' is private in type 'A3' but not in type 'B3'.
public '1': Derived; // error
}
}
module ImplicitPublic {
class A {
private foo: Base;
}
class B extends A {
~
!!! error TS2415: Class 'B' incorrectly extends base class 'A'.
!!! error TS2415: Property 'foo' is private in type 'A' but not in type 'B'.
foo: Derived; // error
}
class A2 {
private 1: Base;
}
class B2 extends A2 {
~~
!!! error TS2415: Class 'B2' incorrectly extends base class 'A2'.
!!! error TS2415: Property '1' is private in type 'A2' but not in type 'B2'.
1: Derived; // error
}
class A3 {
private '1': Base;
}
class B3 extends A3 {
~~
!!! error TS2415: Class 'B3' incorrectly extends base class 'A3'.
!!! error TS2415: Property ''1'' is private in type 'A3' but not in type 'B3'.
'1': Derived; // error
}
}
|