Closed
Description
Hi,
TS: 1.4
Not sure that I agree we should have an error here:
interface Indexer {
[x: string]: number
}
class Base {
foo() : Indexer {
return undefined;
}
}
/*Error: Class 'Foo' incorrectly extends base class 'Base'.
Types of property 'foo' are incompatible.
Type '() => { id: number; }' is not assignable to type '() => Indexer'.
Type '{ id: number; }' is not assignable to type 'Indexer'.
Index signature is missing in type '{ id: number; }'.
*/
class Foo extends Base {
foo() {
return { id: 10 };
}
}