14 lines
No EOL
626 B
Text
14 lines
No EOL
626 B
Text
==== 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'.
|
|
|