How to fix Argument of type 'X' is not assignable to parameter of type 'Y' in TypeScript | DevErrors