# TS2669: Augmentations for the global scope can only be directly nested in external modules or ambient module declarations.

> declare global appears in a file that isn't a module. Add an import or export to the file, or declare the globals at the top level of a .d.ts.

## What it means

`declare global { ... }` is only allowed directly inside a module (a file with a top-level
`import` or `export`) or inside an ambient module declaration. In a script file, top-level
declarations are already global, so the block is rejected.

## Example

```ts
declare global {
  interface Window { appVersion: string }
}
```

## How to fix

- Make the file a module, for example by adding `export {};`.
- Or remove the `declare global` wrapper and declare the names at the top level of a script `.d.ts` file.

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