20 lines
972 B
Plaintext
20 lines
972 B
Plaintext
==== tests/cases/compiler/interfaceImplementation7.ts (2 errors) ====
|
|
interface i1{ name(): { s: string; }; }
|
|
interface i2{ name(): { n: number; }; }
|
|
|
|
interface i3 extends i1, i2 { }
|
|
~~
|
|
!!! error TS2320: Interface 'i3' cannot simultaneously extend types 'i1' and 'i2':
|
|
!!! error TS2320: Named properties 'name' of types 'i1' and 'i2' are not identical.
|
|
interface i4 extends i1, i2 { name(): { s: string; n: number; }; }
|
|
|
|
class C1 implements i4 {
|
|
~~
|
|
!!! error TS2421: Class 'C1' incorrectly implements interface 'i4':
|
|
!!! error TS2421: Types of property 'name' are incompatible:
|
|
!!! error TS2421: Type '() => string' is not assignable to type '() => { s: string; n: number; }':
|
|
!!! error TS2421: Type 'string' is not assignable to type '{ s: string; n: number; }':
|
|
!!! error TS2421: Property 's' is missing in type 'String'.
|
|
public name(): string { return ""; }
|
|
}
|
|
|