67 lines
No EOL
2.2 KiB
Text
67 lines
No EOL
2.2 KiB
Text
tests/cases/compiler/interfaceInheritance.ts(22,7): error TS2420: Class 'C1' incorrectly implements interface 'I2'.
|
|
Property 'i1P1' is missing in type 'C1'.
|
|
tests/cases/compiler/interfaceInheritance.ts(30,1): error TS2322: Type 'I3' is not assignable to type 'I2'.
|
|
Property 'i1P1' is missing in type 'I3'.
|
|
tests/cases/compiler/interfaceInheritance.ts(37,1): error TS2322: Type 'I5' is not assignable to type 'I4'.
|
|
Types of property 'one' are incompatible.
|
|
Type 'string' is not assignable to type 'number'.
|
|
tests/cases/compiler/interfaceInheritance.ts(38,1): error TS2322: Type 'I4' is not assignable to type 'I5'.
|
|
Types of property 'one' are incompatible.
|
|
Type 'number' is not assignable to type 'string'.
|
|
|
|
|
|
==== tests/cases/compiler/interfaceInheritance.ts (4 errors) ====
|
|
interface I1 {
|
|
i1P1: number;
|
|
i1P2(): void;
|
|
}
|
|
|
|
interface I2 extends I1 {
|
|
i2P1: string;
|
|
}
|
|
|
|
interface I3 {
|
|
i2P1: string; // has a member from i2P1, but not from I1
|
|
}
|
|
|
|
interface I4 {
|
|
one: number;
|
|
}
|
|
|
|
interface I5 {
|
|
one: string;
|
|
}
|
|
|
|
class C1 implements I2 { // should be an error - it doesn't implement the members of I1
|
|
~~
|
|
!!! error TS2420: Class 'C1' incorrectly implements interface 'I2'.
|
|
!!! error TS2420: Property 'i1P1' is missing in type 'C1'.
|
|
public i2P1: string;
|
|
}
|
|
|
|
var i2: I2;
|
|
var i1: I1;
|
|
var i3: I3;
|
|
i1 = i2;
|
|
i2 = i3; // should be an error - i3 does not implement the members of i1
|
|
~~
|
|
!!! error TS2322: Type 'I3' is not assignable to type 'I2'.
|
|
!!! error TS2322: Property 'i1P1' is missing in type 'I3'.
|
|
|
|
var c1: C1;
|
|
|
|
var i4: I4;
|
|
var i5: I5;
|
|
|
|
i4 = i5; // should be an error
|
|
~~
|
|
!!! error TS2322: Type 'I5' is not assignable to type 'I4'.
|
|
!!! error TS2322: Types of property 'one' are incompatible.
|
|
!!! error TS2322: Type 'string' is not assignable to type 'number'.
|
|
i5 = i4; // should be an error
|
|
~~
|
|
!!! error TS2322: Type 'I4' is not assignable to type 'I5'.
|
|
!!! error TS2322: Types of property 'one' are incompatible.
|
|
!!! error TS2322: Type 'number' is not assignable to type 'string'.
|
|
|
|
|