TypeScript/tests/baselines/reference/indexerConstraints2.errors.txt

35 lines
842 B
Plaintext
Raw Normal View History

2014-07-13 01:04:16 +02:00
==== 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;
}