TypeScript/tests/baselines/reference/stringIndexerAssignments2.errors.txt
2014-11-05 12:26:03 -08:00

35 lines
1 KiB
Plaintext

tests/cases/compiler/stringIndexerAssignments2.ts(19,1): error TS2322: Type 'C2' is not assignable to type 'C1'.
Index signature is missing in type 'C2'.
tests/cases/compiler/stringIndexerAssignments2.ts(20,1): error TS2322: Type 'C3' is not assignable to type 'C1'.
Types of property 'one' are incompatible.
Type 'number' is not assignable to type 'string'.
==== tests/cases/compiler/stringIndexerAssignments2.ts (2 errors) ====
class C1 {
[index: string]: string
one: string;
}
class C2 {
one: string;
}
class C3 {
one: number;
two: string;
}
var x: C1;
var a: C2;
var b: C3;
x = a;
~
!!! error TS2322: Type 'C2' is not assignable to type 'C1'.
!!! error TS2322: Index signature is missing in type 'C2'.
x = b;
~
!!! error TS2322: Type 'C3' is not assignable to type 'C1'.
!!! error TS2322: Types of property 'one' are incompatible.
!!! error TS2322: Type 'number' is not assignable to type 'string'.