How to fix Cannot assign to 'X' because it is a read-only property in TypeScript | DevErrors