How to fix Operator 'in' cannot be applied to types 'X' and 'Y' in TypeScript | DevErrors