68 lines
1.6 KiB
Plaintext
68 lines
1.6 KiB
Plaintext
==== tests/cases/compiler/interfaceDeclaration1.ts (6 errors) ====
|
|
interface I1 {
|
|
item:number;
|
|
item:number;
|
|
~~~~
|
|
!!! error TS2300: Duplicate identifier 'item'.
|
|
}
|
|
|
|
interface I2 {
|
|
item:any;
|
|
item:number;
|
|
~~~~
|
|
!!! error TS2300: Duplicate identifier 'item'.
|
|
}
|
|
|
|
interface I3 {
|
|
prototype:number;
|
|
}
|
|
|
|
interface I4 {
|
|
class:number;
|
|
number:number;
|
|
super:number;
|
|
prototype:number;
|
|
}
|
|
|
|
interface I5 extends I5 {
|
|
~~
|
|
!!! error TS2310: Type 'I5' recursively references itself as a base type.
|
|
foo():void;
|
|
}
|
|
|
|
interface I6 {
|
|
():void;
|
|
}
|
|
|
|
interface I7 extends I6 { }
|
|
|
|
var v1:I7;
|
|
v1();
|
|
|
|
class C1 implements I3 {
|
|
~~
|
|
!!! error TS2421: Class 'C1' incorrectly implements interface 'I3':
|
|
!!! error TS2421: Property 'prototype' is missing in type 'C1'.
|
|
constructor() {
|
|
var prototype: number = 3;
|
|
}
|
|
}
|
|
|
|
interface i8 extends i9 { }
|
|
~~
|
|
!!! error TS2310: Type 'i8' recursively references itself as a base type.
|
|
interface i9 extends i8 { }
|
|
|
|
interface i10 {
|
|
foo():number;
|
|
}
|
|
|
|
interface i11{
|
|
foo():string;
|
|
}
|
|
|
|
interface i12 extends i10, i11 { }
|
|
~~~
|
|
!!! error TS2320: Interface 'i12' cannot simultaneously extend types 'i10' and 'i11':
|
|
!!! error TS2320: Named properties 'foo' of types 'i10' and 'i11' are not identical.
|
|
|