# TS2584: Cannot find name '…'. Do you need to change your target library? Try changing the 'lib' compiler option to include 'dom'.

> A browser global such as document is used but the DOM library isn't loaded. Add "dom" to the lib option, or don't use browser APIs in this code.

## What it means

The name is a global from the browser's DOM library (for example `document` or `window`), and the
project's `lib` option doesn't include `"dom"`, so the checker doesn't know it.

## Example

```json
{ "compilerOptions": { "lib": ["es2022"] } }
```

```ts
document.title = "x";
export {};
```

## How to fix

- For code that runs in a browser, add `"dom"` to `lib` in `tsconfig.json`: `"lib": ["es2022", "dom"]`.
- For code that runs elsewhere (Node, a worker), use that environment's APIs instead.

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