# TS2435: Ambient modules cannot be nested in other modules or namespaces.

> A declare module "name" block appears inside another module or namespace. Move it to the top level of a declaration file.

## What it means

Ambient module declarations (`declare module "some-package" { ... }`) describe a whole module
by its name, so they must be at the top level of a file. Nested inside a namespace or another
module declaration they're reported.

## Example

```ts
export namespace Vendor {
  declare module "vendor-lib" {
    export const version: string;
  }
}
```

## How to fix

- Move the `declare module "..."` block to the top level of a `.d.ts` file.
- To add to a module from inside a file that is itself a module, write `declare module "name"` at that file's top level (a module augmentation).

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