mirror of
https://github.com/hanzoai/tsgo.git
synced 2026-10-30 19:37:15 +00:00
53 lines
2.3 KiB
Plaintext
53 lines
2.3 KiB
Plaintext
derivedClassWithPrivateStaticShadowingPublicStatic.ts(13,7): error TS2417: Class static side 'typeof Derived' incorrectly extends base class static side 'typeof Base'.
|
|
Property 'x' is private in type 'typeof Derived' but not in type 'typeof Base'.
|
|
derivedClassWithPrivateStaticShadowingPublicStatic.ts(24,18): error TS2341: Property 'x' is private and only accessible within class 'Derived'.
|
|
derivedClassWithPrivateStaticShadowingPublicStatic.ts(27,18): error TS2341: Property 'fn' is private and only accessible within class 'Derived'.
|
|
derivedClassWithPrivateStaticShadowingPublicStatic.ts(32,18): error TS2341: Property 'a' is private and only accessible within class 'Derived'.
|
|
derivedClassWithPrivateStaticShadowingPublicStatic.ts(33,9): error TS2341: Property 'a' is private and only accessible within class 'Derived'.
|
|
|
|
|
|
==== derivedClassWithPrivateStaticShadowingPublicStatic.ts (5 errors) ====
|
|
class Base {
|
|
public static x: string;
|
|
public static fn(): string {
|
|
return '';
|
|
}
|
|
|
|
public static get a() { return 1; }
|
|
public static set a(v) { }
|
|
}
|
|
|
|
// BUG 847404
|
|
// should be error
|
|
class Derived extends Base {
|
|
~~~~~~~
|
|
!!! error TS2417: Class static side 'typeof Derived' incorrectly extends base class static side 'typeof Base'.
|
|
!!! error TS2417: Property 'x' is private in type 'typeof Derived' but not in type 'typeof Base'.
|
|
private static x: string;
|
|
private static fn(): string {
|
|
return '';
|
|
}
|
|
|
|
private static get a() { return 1; }
|
|
private static set a(v) { }
|
|
}
|
|
|
|
var r = Base.x; // ok
|
|
var r2 = Derived.x; // error
|
|
~
|
|
!!! error TS2341: Property 'x' is private and only accessible within class 'Derived'.
|
|
|
|
var r3 = Base.fn(); // ok
|
|
var r4 = Derived.fn(); // error
|
|
~~
|
|
!!! error TS2341: Property 'fn' is private and only accessible within class 'Derived'.
|
|
|
|
var r5 = Base.a; // ok
|
|
Base.a = 2; // ok
|
|
|
|
var r6 = Derived.a; // error
|
|
~
|
|
!!! error TS2341: Property 'a' is private and only accessible within class 'Derived'.
|
|
Derived.a = 2; // error
|
|
~
|
|
!!! error TS2341: Property 'a' is private and only accessible within class 'Derived'. |