TypeScript/tests/cases/compiler/assignmentCompat1.ts

12 lines
317 B
TypeScript
Raw Normal View History

2015-07-30 19:01:34 +02:00
var x = { one: 1 };
var y: { [index: string]: any };
var z: { [index: number]: any };
x = y; // Error
y = x; // Ok because index signature type is any
x = z; // Error
z = x; // Ok because index signature type is any
2015-10-15 18:52:31 +02:00
y = "foo"; // Error
z = "foo"; // OK, string has numeric indexer
z = false; // Error
2015-10-15 18:52:31 +02:00