How to fix Type 'X[]' must have a '[Symbol.iterator]()' method that returns an iterator in TypeScript | DevErrors