58 lines
No EOL
1.8 KiB
Text
58 lines
No EOL
1.8 KiB
Text
tests/cases/compiler/interfaceImplementation8.ts(12,7): error TS2420: Class 'C2' incorrectly implements interface 'i1'.
|
|
Property 'name' is private in type 'C2' but not in type 'i1'.
|
|
tests/cases/compiler/interfaceImplementation8.ts(21,7): error TS2420: Class 'C5' incorrectly implements interface 'i1'.
|
|
Property 'name' is private in type 'C5' but not in type 'i1'.
|
|
tests/cases/compiler/interfaceImplementation8.ts(22,7): error TS2420: Class 'C6' incorrectly implements interface 'i1'.
|
|
Property 'name' is private in type 'C6' but not in type 'i1'.
|
|
|
|
|
|
==== tests/cases/compiler/interfaceImplementation8.ts (3 errors) ====
|
|
/*
|
|
1
|
|
*/
|
|
interface i1 {
|
|
name: string;
|
|
}
|
|
|
|
class C1 implements i1 {
|
|
public name:string;
|
|
}
|
|
|
|
class C2 implements i1 {
|
|
~~
|
|
!!! error TS2420: Class 'C2' incorrectly implements interface 'i1'.
|
|
!!! error TS2420: Property 'name' is private in type 'C2' but not in type 'i1'.
|
|
private name:string;
|
|
}
|
|
|
|
class C3 {
|
|
private name:any;
|
|
}
|
|
|
|
class C4 extends C1 implements i1{ }
|
|
class C5 extends C2 implements i1{ }
|
|
~~
|
|
!!! error TS2420: Class 'C5' incorrectly implements interface 'i1'.
|
|
!!! error TS2420: Property 'name' is private in type 'C5' but not in type 'i1'.
|
|
class C6 extends C3 implements i1{ }
|
|
~~
|
|
!!! error TS2420: Class 'C6' incorrectly implements interface 'i1'.
|
|
!!! error TS2420: Property 'name' is private in type 'C6' but not in type 'i1'.
|
|
|
|
/*
|
|
2
|
|
*/
|
|
|
|
interface i2 {
|
|
name: string;
|
|
age: number;
|
|
}
|
|
|
|
class C7 {
|
|
public name:string;
|
|
}
|
|
|
|
class C8 extends C7 implements i2{
|
|
public age:number;
|
|
}
|
|
|