2014-12-06 01:58:49 +01:00
|
|
|
tests/cases/compiler/objectLiteralIndexerErrors.ts(13,5): error TS2322: Type '{ [x: string]: A; [x: number]: A; 0: A; x: B; }' is not assignable to type '{ [s: string]: A; [n: number]: B; }'.
|
2014-10-28 08:28:59 +01:00
|
|
|
Index signatures are incompatible.
|
|
|
|
Type 'A' is not assignable to type 'B'.
|
2014-09-12 22:35:07 +02:00
|
|
|
|
|
|
|
|
2014-07-13 01:04:16 +02:00
|
|
|
==== tests/cases/compiler/objectLiteralIndexerErrors.ts (1 errors) ====
|
|
|
|
interface A {
|
|
|
|
x: number;
|
|
|
|
}
|
|
|
|
|
|
|
|
interface B extends A {
|
|
|
|
y: string;
|
|
|
|
}
|
|
|
|
|
|
|
|
var a: A;
|
|
|
|
var b: B;
|
|
|
|
var c: any;
|
|
|
|
|
|
|
|
var o1: { [s: string]: A;[n: number]: B; } = { x: b, 0: a }; // both indexers are A
|
2014-07-19 02:30:06 +02:00
|
|
|
~~
|
2014-12-06 01:58:49 +01:00
|
|
|
!!! error TS2322: Type '{ [x: string]: A; [x: number]: A; 0: A; x: B; }' is not assignable to type '{ [s: string]: A; [n: number]: B; }'.
|
2014-11-05 21:26:03 +01:00
|
|
|
!!! error TS2322: Index signatures are incompatible.
|
|
|
|
!!! error TS2322: Type 'A' is not assignable to type 'B'.
|
2014-07-13 01:04:16 +02:00
|
|
|
o1 = { x: c, 0: a }; // string indexer is any, number indexer is A
|