20 lines
651 B
Text
20 lines
651 B
Text
|
==== tests/cases/compiler/indexerAssignability.ts (3 errors) ====
|
||
|
var a: { [s: string]: string; };
|
||
|
var b: { [n: number]: string; };
|
||
|
var c: {};
|
||
|
|
||
|
a = b;
|
||
|
~
|
||
|
!!! Type '{ [x: number]: string; }' is not assignable to type '{ [x: string]: string; }':
|
||
|
!!! Index signature is missing in type '{ [x: number]: string; }'.
|
||
|
a = c;
|
||
|
~
|
||
|
!!! Type '{}' is not assignable to type '{ [x: string]: string; }':
|
||
|
!!! Index signature is missing in type '{}'.
|
||
|
b = a;
|
||
|
b = c;
|
||
|
~
|
||
|
!!! Type '{}' is not assignable to type '{ [x: number]: string; }':
|
||
|
!!! Index signature is missing in type '{}'.
|
||
|
c = a;
|
||
|
c = b;
|