TypeScript/tests/baselines/reference/stringIndexerAssignments1.errors.txt

14 lines
626 B
Plaintext
Raw Normal View History

2014-07-13 01:04:16 +02:00
==== tests/cases/compiler/stringIndexerAssignments1.ts (2 errors) ====
var x: { [index: string]: string; one: string; };
var a: { one: string; };
var b: { one: number; two: string; };
x = a;
~
!!! Type '{ one: string; }' is not assignable to type '{ [x: string]: string; one: string; }':
!!! Index signature is missing in type '{ one: string; }'.
x = b; // error
~
!!! Type '{ one: number; two: string; }' is not assignable to type '{ [x: string]: string; one: string; }':
!!! Types of property 'one' are incompatible:
!!! Type 'number' is not assignable to type 'string'.