TypeScript/tests/baselines/reference/indexerConstraints2.errors.txt
2014-07-12 17:30:19 -07:00

35 lines
842 B
Plaintext

==== tests/cases/compiler/indexerConstraints2.ts (3 errors) ====
class A { a: number; }
class B extends A { b: number; }
// Inheritance
class F {
[s: string]: B
}
class G extends F {
[n: number]: A
~~~~~~~~~~~~~~
!!! Numeric index type 'A' is not assignable to string index type 'B'.
}
// Other way
class H {
[n: number]: A
}
class I extends H {
[s: string]: B
~~~~~~~~~~~~~~
!!! Numeric index type 'A' is not assignable to string index type 'B'.
}
// With hidden indexer
class J {
[n: number]: {}
}
class K extends J {
[n: number]: A;
~~~~~~~~~~~~~~~
!!! Numeric index type 'A' is not assignable to string index type 'B'.
[s: string]: B;
}