Closed
Description
Hi,
TS:1.4
The compiler issues an error on property bar
below:
interface Foo {
[x: string]: number|Foo;
}
interface Bar extends Foo {
/* Error: Property 'bar' of type '{ num: number; }'
is not assignable to string index type 'number | Foo'. */
bar: { num: number };
}
My understanding of this is "any type that extends Foo
is permitted to have a property that is either a number or an object that is indexable by string to produce a number or..(and so on) ".
The latter case is clearly true for {num: number}
and yet the compiler issues an error.