2014-09-12 22:35:07 +02:00
tests/cases/conformance/types/typeRelationships/typeInference/indexSignatureTypeInference.ts(18,27): error TS2345: Argument of type 'NumberMap<Function>' is not assignable to parameter of type 'StringMap<{}>'.
2014-09-06 03:42:05 +02:00
==== tests/cases/conformance/types/typeRelationships/typeInference/indexSignatureTypeInference.ts (1 errors) ====
2014-07-22 20:53:06 +02:00
interface NumberMap<T> {
[index: number]: T;
}
interface StringMap<T> {
[index: string]: T;
}
declare function numberMapToArray<T>(object: NumberMap<T>): T[];
declare function stringMapToArray<T>(object: StringMap<T>): T[];
var numberMap: NumberMap<Function>;
var stringMap: StringMap<Function>;
var v1: Function[];
var v1 = numberMapToArray(numberMap); // Ok
var v1 = numberMapToArray(stringMap); // Ok
var v1 = stringMapToArray(numberMap); // Error expected here
2014-07-25 02:00:03 +02:00
~~~~~~~~~
2014-09-12 00:19:57 +02:00
!!! error TS2345: Argument of type 'NumberMap<Function>' is not assignable to parameter of type 'StringMap<{}>'.
2014-07-22 20:53:06 +02:00
var v1 = stringMapToArray(stringMap); // Ok