mirror of
https://github.com/hanzoai/tsgo.git
synced 2026-10-30 19:37:15 +00:00
70 lines
3.5 KiB
Plaintext
70 lines
3.5 KiB
Plaintext
derivedClassWithPrivateInstanceShadowingPublicInstance.ts(2,12): error TS2564: Property 'x' has no initializer and is not definitely assigned in the constructor.
|
|
derivedClassWithPrivateInstanceShadowingPublicInstance.ts(12,7): error TS2415: Class 'Derived' incorrectly extends base class 'Base'.
|
|
Property 'x' is private in type 'Derived' but not in type 'Base'.
|
|
derivedClassWithPrivateInstanceShadowingPublicInstance.ts(13,13): error TS2564: Property 'x' has no initializer and is not definitely assigned in the constructor.
|
|
derivedClassWithPrivateInstanceShadowingPublicInstance.ts(22,14): error TS2339: Property 'x' does not exist on type 'typeof Base'.
|
|
derivedClassWithPrivateInstanceShadowingPublicInstance.ts(23,18): error TS2339: Property 'x' does not exist on type 'typeof Derived'.
|
|
derivedClassWithPrivateInstanceShadowingPublicInstance.ts(25,15): error TS2339: Property 'fn' does not exist on type 'typeof Base'.
|
|
derivedClassWithPrivateInstanceShadowingPublicInstance.ts(26,18): error TS2339: Property 'fn' does not exist on type 'typeof Derived'.
|
|
derivedClassWithPrivateInstanceShadowingPublicInstance.ts(28,15): error TS2339: Property 'a' does not exist on type 'typeof Base'.
|
|
derivedClassWithPrivateInstanceShadowingPublicInstance.ts(29,6): error TS2339: Property 'a' does not exist on type 'typeof Base'.
|
|
derivedClassWithPrivateInstanceShadowingPublicInstance.ts(31,18): error TS2339: Property 'a' does not exist on type 'typeof Derived'.
|
|
derivedClassWithPrivateInstanceShadowingPublicInstance.ts(32,9): error TS2339: Property 'a' does not exist on type 'typeof Derived'.
|
|
|
|
|
|
==== derivedClassWithPrivateInstanceShadowingPublicInstance.ts (11 errors) ====
|
|
class Base {
|
|
public x: string;
|
|
~
|
|
!!! error TS2564: Property 'x' has no initializer and is not definitely assigned in the constructor.
|
|
public fn(): string {
|
|
return '';
|
|
}
|
|
|
|
public get a() { return 1; }
|
|
public set a(v) { }
|
|
}
|
|
|
|
// error, not a subtype
|
|
class Derived extends Base {
|
|
~~~~~~~
|
|
!!! error TS2415: Class 'Derived' incorrectly extends base class 'Base'.
|
|
!!! error TS2415: Property 'x' is private in type 'Derived' but not in type 'Base'.
|
|
private x: string;
|
|
~
|
|
!!! error TS2564: Property 'x' has no initializer and is not definitely assigned in the constructor.
|
|
private fn(): string {
|
|
return '';
|
|
}
|
|
|
|
private get a() { return 1; }
|
|
private set a(v) { }
|
|
}
|
|
|
|
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'. |