# TS2407: The right-hand side of a 'for...in' statement must be of type 'any', an object type or a type parameter, but here has type '…'.

> The value after "in" in a for...in loop is a primitive. Loop over an object, or use for...of for strings and arrays.

## What it means

`for...in` walks the enumerable keys of an object. Using it on a value whose type is a
primitive such as `number` or `boolean` is reported, because it has no keys of its own to
visit.

## Example

```ts
const total = 3;
for (const key in total) {
  console.log(key);
}
```

## How to fix

- Loop over the object you meant: `for (const key in record)`.
- Use `for...of` for the values of an array or the characters of a string.
- Use a counting loop for a number of iterations.

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