How to fix Type 'X' is not assignable to type 'Y & Z' in TypeScript | DevErrors