How to fix 'this' context of type 'X' is not assignable to method's 'this' of type 'Y' in TypeScript | DevErrors