# TS7053: Element implicitly has an 'any' type because expression of type '…' can't be used to index type '…'.

> An object is indexed with a key that its type doesn't declare, so the result would be `any`. Narrow the key or add an index signature.

## What it means

Under `noImplicitAny`, indexing an object with an expression whose type isn't a known key (for
example a general `string` on an object type with fixed properties) has no declared result
type, so it would be implicitly `any`.

## Example

```ts
const prices = { apple: 1, pear: 2 };
declare const fruit: string;
export const p = prices[fruit];
```

## How to fix

- Narrow the key to the known keys: `declare const fruit: keyof typeof prices`.
- If any string key is valid, give the object an index signature:
  `const prices: Record<string, number> = { ... }`.
- Use a `Map` for dynamic keys.

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