# TS2538: Type '…' cannot be used as an index type.

> A value whose type can't be a property key is used inside [ ] as an index. Use a string, number or symbol key.

## What it means

Element access `obj[key]` and indexed access types `T[K]` need a key type that can name a
property. Using an object type, a boolean or similar as the index is reported.

## Example

```ts
const prices: Record<string, number> = {};
const item = { id: "a" };
export const p = prices[item];
```

## How to fix

- Index with a string, number or symbol: `prices[item.id]`.
- Use a `Map` if you want objects as keys.

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