TypeScript/tests/baselines/reference/interfaceInheritance.errors.txt
2014-07-12 17:30:19 -07:00

55 lines
1.4 KiB
Plaintext

==== 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
~~
!!! Class 'C1' incorrectly implements interface 'I2':
!!! 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
~~
!!! Type 'I3' is not assignable to type 'I2':
!!! Property 'i1P1' is missing in type 'I3'.
var c1: C1;
var i4: I4;
var i5: I5;
i4 = i5; // should be an error
~~
!!! Type 'I5' is not assignable to type 'I4':
!!! Types of property 'one' are incompatible:
!!! Type 'string' is not assignable to type 'number'.
i5 = i4; // should be an error
~~
!!! Type 'I4' is not assignable to type 'I5':
!!! Types of property 'one' are incompatible:
!!! Type 'number' is not assignable to type 'string'.