57 lines
No EOL
1.5 KiB
Text
57 lines
No EOL
1.5 KiB
Text
==== tests/cases/compiler/interfaceDeclaration4.ts (6 errors) ====
|
|
// Import this module when test harness supports external modules. Also remove the internal module below.
|
|
// import Foo = require("interfaceDeclaration5")
|
|
module Foo {
|
|
export interface I1 { item: string; }
|
|
export class C1 { }
|
|
}
|
|
|
|
class C1 implements Foo.I1 {
|
|
public item:string;
|
|
}
|
|
|
|
// Allowed
|
|
interface I2 extends Foo.I1 {
|
|
item:string;
|
|
}
|
|
|
|
// Negative Case
|
|
interface I3 extends Foo.I1 {
|
|
~~
|
|
!!! Interface 'I3' incorrectly extends interface 'I1':
|
|
!!! Types of property 'item' are incompatible:
|
|
!!! Type 'number' is not assignable to type 'string'.
|
|
item:number;
|
|
}
|
|
|
|
interface I4 extends Foo.I1 {
|
|
token:string;
|
|
}
|
|
|
|
// Err - not implemented item
|
|
class C2 implements I4 {
|
|
~~
|
|
!!! Class 'C2' incorrectly implements interface 'I4':
|
|
!!! Property 'item' is missing in type 'C2'.
|
|
public token: string;
|
|
}
|
|
|
|
interface I5 extends Foo { }
|
|
|
|
// Negative case
|
|
interface I6 extends Foo.C1 { }
|
|
|
|
class C3 implements Foo.I1 { }
|
|
~~
|
|
!!! Class 'C3' incorrectly implements interface 'I1':
|
|
!!! Property 'item' is missing in type 'C3'.
|
|
|
|
// Negative case
|
|
interface Foo.I1 { }
|
|
~
|
|
!!! '{' expected.
|
|
~
|
|
!!! ';' expected.
|
|
~~
|
|
!!! Cannot find name 'I1'.
|
|
|