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/interfaceExtendingClassWithProtecteds2.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/interfaceExtendingClassWithProtecteds2.ts(12,11): error TS2430: Interface 'I4' incorrectly extends interface 'Bar'.
Property 'x' is protected but type 'I4' is not a class derived from 'Bar'.
tests/cases/conformance/interfaces/interfacesExtendingClasses/interfaceExtendingClassWithProtecteds2.ts(12,11): error TS2430: Interface 'I4' incorrectly extends interface 'Foo'.
Property 'x' is protected but type 'I4' is not a class derived from 'Foo'.
tests/cases/conformance/interfaces/interfacesExtendingClasses/interfaceExtendingClassWithProtecteds2.ts(26,12): error TS2445: Property 'x' is protected and only accessible within class 'Foo' and its subclasses.
tests/cases/conformance/interfaces/interfacesExtendingClasses/interfaceExtendingClassWithProtecteds2.ts(27,12): error TS2445: Property 'y' is protected and only accessible within class 'Baz' and its subclasses.
==== tests/cases/conformance/interfaces/interfacesExtendingClasses/interfaceExtendingClassWithProtecteds2.ts (5 errors) ====
class Foo {
protected x: string;
}
class Bar {
protected 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 protected but type 'I4' is not a class derived from 'Bar'.
~~
!!! error TS2430: Interface 'I4' incorrectly extends interface 'Foo'.
!!! error TS2430: Property 'x' is protected but type 'I4' is not a class derived from 'Foo'.
x: string;
}
class Baz {
protected y: string;
}
interface I5 extends Foo, Baz {
z: string;
}
var i: I5;
var r: string = i.z;
var r2 = i.x; // error
~
!!! error TS2445: Property 'x' is protected and only accessible within class 'Foo' and its subclasses.
var r3 = i.y; // error
~
!!! error TS2445: Property 'y' is protected and only accessible within class 'Baz' and its subclasses.
|