# TS2488: Type '…' must have a '[Symbol.iterator]()' method that returns an iterator.

> A value that isn't iterable is used with for...of, spread or array destructuring. Iterate over an array or iterable, or convert the value first.

## What it means

`for...of`, `[...x]` and `const [a, b] = x` call the value's `[Symbol.iterator]()` method. When
the type has no such method, the code would throw at runtime.

## Example

```ts
const counts = { a: 1, b: 2 };
for (const c of counts) {
  console.log(c);
}
```

## How to fix

- Iterate over an iterable view: `Object.values(counts)`, `Object.entries(counts)`, `map.entries()`.
- Check the target `lib` includes the iterables you use (for example `Map` and `Set` iteration needs ES2015 or later).

Source: https://ts-r.dev/errors/TS2488/
