2014-09-12 22:35:07 +02:00
|
|
|
tests/cases/compiler/derivedTypeIncompatibleSignatures.ts(21,11): error TS2429: Interface 'F' incorrectly extends interface 'E':
|
|
|
|
Index signatures are incompatible:
|
|
|
|
Type 'number' is not assignable to type 'string'.
|
|
|
|
tests/cases/compiler/derivedTypeIncompatibleSignatures.ts(29,11): error TS2429: Interface 'H' incorrectly extends interface 'G':
|
|
|
|
Index signatures are incompatible:
|
|
|
|
Type 'number' is not assignable to type 'string'.
|
|
|
|
|
|
|
|
|
2014-07-13 01:04:16 +02:00
|
|
|
==== tests/cases/compiler/derivedTypeIncompatibleSignatures.ts (2 errors) ====
|
|
|
|
interface A {
|
|
|
|
(a: string): string;
|
|
|
|
}
|
|
|
|
|
|
|
|
interface B extends A {
|
|
|
|
(a: string): number; // Number is not a subtype of string. Should error.
|
|
|
|
}
|
|
|
|
|
|
|
|
interface C {
|
|
|
|
new (a: string): string;
|
|
|
|
}
|
|
|
|
|
|
|
|
interface D extends C {
|
|
|
|
new (a: string): number; // Number is not a subtype of string. Should error.
|
|
|
|
}
|
|
|
|
|
|
|
|
interface E {
|
|
|
|
[a: string]: string;
|
|
|
|
}
|
|
|
|
|
|
|
|
interface F extends E {
|
|
|
|
~
|
2014-09-12 00:19:57 +02:00
|
|
|
!!! error TS2429: Interface 'F' incorrectly extends interface 'E':
|
|
|
|
!!! error TS2429: Index signatures are incompatible:
|
|
|
|
!!! error TS2429: Type 'number' is not assignable to type 'string'.
|
2014-07-13 01:04:16 +02:00
|
|
|
[a: string]: number; // Number is not a subtype of string. Should error.
|
|
|
|
}
|
|
|
|
|
|
|
|
interface G {
|
|
|
|
[a: number]: string;
|
|
|
|
}
|
|
|
|
|
|
|
|
interface H extends G {
|
|
|
|
~
|
2014-09-12 00:19:57 +02:00
|
|
|
!!! error TS2429: Interface 'H' incorrectly extends interface 'G':
|
|
|
|
!!! error TS2429: Index signatures are incompatible:
|
|
|
|
!!! error TS2429: Type 'number' is not assignable to type 'string'.
|
2014-07-13 01:04:16 +02:00
|
|
|
[a: number]: number; // Should error for the same reason
|
|
|
|
}
|