-
Notifications
You must be signed in to change notification settings - Fork 13.2k
Closed
Labels
By DesignDeprecated - use "Working as Intended" or "Design Limitation" insteadDeprecated - use "Working as Intended" or "Design Limitation" instead
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.
Metadata
Metadata
Assignees
Labels
By DesignDeprecated - use "Working as Intended" or "Design Limitation" insteadDeprecated - use "Working as Intended" or "Design Limitation" instead