I am struggling with the implementation of an extended interface in a class.
Below is a simplified example (with playground link at the end of the post):
interface A {
hello:string
}
interface Extension extends A {
bye:string
}
class Greeting implements Extension {
constructor(){
this.hello="hi"
this.bye= "bye"
}
}
The error states:
Property 'hello' does not exist on type 'Greeting'.
along with other errors.
I recognize that this is due to the lack of type definition, but why is it necessary when I am already implementing the interface? Is there a more efficient way to achieve this without essentially duplicating the definition of the Extension
interface?
The current approach seems logical to me, but I am struggling to grasp the correct procedure. Can you provide guidance?