2014-09-12 22:35:07 +02:00
tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithStringIndexer3.ts(7,8): error TS2304: Cannot find name 'A'.
2014-10-28 08:28:59 +01:00
tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithStringIndexer3.ts(20,9): error TS2323: Type '{ [x: string]: string; }' is not assignable to type 'A<T>'.
Index signatures are incompatible.
2014-09-12 22:35:07 +02:00
Type 'string' is not assignable to type 'T'.
2014-10-28 08:28:59 +01:00
tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithStringIndexer3.ts(21,9): error TS2323: Type 'A<T>' is not assignable to type '{ [x: string]: string; }'.
Index signatures are incompatible.
2014-09-12 22:35:07 +02:00
Type 'T' is not assignable to type 'string'.
2014-07-13 01:04:16 +02:00
==== tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithStringIndexer3.ts (3 errors) ====
// Derived type indexer must be subtype of base type indexer
interface Base { foo: string; }
interface Derived extends Base { bar: string; }
interface Derived2 extends Derived { baz: string; }
var a: A;
~
2014-09-12 00:19:57 +02:00
!!! error TS2304: Cannot find name 'A'.
2014-07-13 01:04:16 +02:00
var b1: { [x: string]: string; }
a = b1; // error
b1 = a; // error
module Generics {
class A<T extends Derived> {
[x: string]: T;
}
function foo<T extends Derived>() {
var a: A<T>;
var b: { [x: string]: string; }
a = b; // error
~
2014-10-28 08:28:59 +01:00
!!! error TS2323: Type '{ [x: string]: string; }' is not assignable to type 'A<T>'.
!!! error TS2323: Index signatures are incompatible.
!!! error TS2323: Type 'string' is not assignable to type 'T'.
2014-07-13 01:04:16 +02:00
b = a; // error
~
2014-10-28 08:28:59 +01:00
!!! error TS2323: Type 'A<T>' is not assignable to type '{ [x: string]: string; }'.
!!! error TS2323: Index signatures are incompatible.
!!! error TS2323: Type 'T' is not assignable to type 'string'.
2014-07-13 01:04:16 +02:00
}
}