I am faced with a situation where I need to implement multiple interfaces (such as IUserAccess) in my code base.
All of these interfaces extend the IBase interface which includes an Execute method. To avoid repetitive code, I want to implement the Execute method only once.
Here is a simplified version of my code:
class IBase{
Execute(data: any): void{
console.log('Execute');
};
interface IUserAccess extends IBase {
CheckPassword(username: string, password: string): boolean;
}
class UserAccess implements IUserAccess{
CheckPassword(username: string, password: string): boolean {
console.log('CheckPassword');
Execute({...});
...
}
}
However, my IDE is flagging an error:
>Class 'UserAccess' incorrectly implements interface 'IUserAccess'.
Property 'Execute' is missing in type 'UserAccess' but required in type 'IUserAccess'.
How can I address this issue?