Closed
Description
interface A {
foo: Function;
}
class B implements A {
constructor() {
this.foo = () => {};
}
}
Here TypeScript says that B
incorrectly implements A
and requires B
to also have foo
property with the same signature. So question is: why I need duplicate definition of properties when implement interface if I cannot override that definition anyway:
interface A {
foo: Function;
}
class B implements A {
foo: boolean;
constructor() {
this.foo = true;
}
}
Here B
again incorrectly implements A
. Only way to fix it is to add foo:Function
to B
which absolutely has no point since A
already has that.