# TS2449: Class '…' used before its declaration.

> A class is used before its class declaration has run. Move the declaration above the use, or defer the use into a function.

## What it means

Class declarations behave like `let`: the name exists in its scope but can't be used until the
declaration has been evaluated. Using it earlier, for example with `new` at the top of a file,
throws at runtime.

## Example

```ts
export const store = new Store();
class Store {}
```

## How to fix

- Move the class declaration above the code that uses it.
- Uses inside functions that run later are allowed; move the use into one if order can't change.

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