How to fix Function return type must be assignable to base class return type 'X' in TypeScript | DevErrors