mirror of
https://github.com/hanzoai/tsgo.git
synced 2026-10-30 19:37:15 +00:00
42 lines
1.4 KiB
Plaintext
42 lines
1.4 KiB
Plaintext
mergedInterfacesWithInheritedPrivates.ts(13,7): error TS2420: Class 'D' incorrectly implements interface 'A'.
|
|
Types have separate declarations of a private property 'x'.
|
|
mergedInterfacesWithInheritedPrivates.ts(19,7): error TS2420: Class 'E' incorrectly implements interface 'A'.
|
|
Property 'x' is private in type 'A' but not in type 'E'.
|
|
mergedInterfacesWithInheritedPrivates.ts(26,11): error TS2341: Property 'x' is private and only accessible within class 'C'.
|
|
|
|
|
|
==== mergedInterfacesWithInheritedPrivates.ts (3 errors) ====
|
|
class C {
|
|
private x!: number;
|
|
}
|
|
|
|
interface A extends C {
|
|
y: string;
|
|
}
|
|
|
|
interface A {
|
|
z: string;
|
|
}
|
|
|
|
class D implements A { // error
|
|
~
|
|
!!! error TS2420: Class 'D' incorrectly implements interface 'A'.
|
|
!!! error TS2420: Types have separate declarations of a private property 'x'.
|
|
private x!: number;
|
|
y!: string;
|
|
z!: string;
|
|
}
|
|
|
|
class E implements A { // error
|
|
~
|
|
!!! error TS2420: Class 'E' incorrectly implements interface 'A'.
|
|
!!! error TS2420: Property 'x' is private in type 'A' but not in type 'E'.
|
|
x!: number;
|
|
y!: string;
|
|
z!: string;
|
|
}
|
|
|
|
declare var a: A;
|
|
var r = a.x; // error
|
|
~
|
|
!!! error TS2341: Property 'x' is private and only accessible within class 'C'. |