60 lines
2.1 KiB
Plaintext
60 lines
2.1 KiB
Plaintext
==== tests/cases/conformance/classes/members/inheritanceAndOverriding/derivedClassWithPrivateInstanceShadowingPublicInstance.ts (13 errors) ====
|
|
class Base {
|
|
public x: string;
|
|
public fn(): string {
|
|
return '';
|
|
}
|
|
|
|
public get a() { return 1; }
|
|
~
|
|
!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.
|
|
public set a(v) { }
|
|
~
|
|
!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.
|
|
}
|
|
|
|
// error, not a subtype
|
|
class Derived extends Base {
|
|
~~~~~~~
|
|
!!! error TS2416: Class 'Derived' incorrectly extends base class 'Base':
|
|
!!! error TS2416: Private property 'x' cannot be reimplemented.
|
|
private x: string;
|
|
private fn(): string {
|
|
return '';
|
|
}
|
|
|
|
private get a() { return 1; }
|
|
~
|
|
!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.
|
|
private set a(v) { }
|
|
~
|
|
!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.
|
|
}
|
|
|
|
var r = Base.x; // ok
|
|
~
|
|
!!! error TS2339: Property 'x' does not exist on type 'typeof Base'.
|
|
var r2 = Derived.x; // error
|
|
~
|
|
!!! error TS2339: Property 'x' does not exist on type 'typeof Derived'.
|
|
|
|
var r3 = Base.fn(); // ok
|
|
~~
|
|
!!! error TS2339: Property 'fn' does not exist on type 'typeof Base'.
|
|
var r4 = Derived.fn(); // error
|
|
~~
|
|
!!! error TS2339: Property 'fn' does not exist on type 'typeof Derived'.
|
|
|
|
var r5 = Base.a; // ok
|
|
~
|
|
!!! error TS2339: Property 'a' does not exist on type 'typeof Base'.
|
|
Base.a = 2; // ok
|
|
~
|
|
!!! error TS2339: Property 'a' does not exist on type 'typeof Base'.
|
|
|
|
var r6 = Derived.a; // error
|
|
~
|
|
!!! error TS2339: Property 'a' does not exist on type 'typeof Derived'.
|
|
Derived.a = 2; // error
|
|
~
|
|
!!! error TS2339: Property 'a' does not exist on type 'typeof Derived'. |