microsoft / microsoft/TypeScript

No error when exporting from global augmentations

Open
#64,152 0 comments 1 reaction 2 assignees View on GitHub

@DanielRosenwasser is already working on this.

Since Sep 4, 2026.

  • #64162 by @copilot-swe-agent — open
Breaking Change Bug
Dominant language
Go
Stars
111k
Forks
14.3k
Avg merge
2d 4h
Merged PRs (30d)
132

Description

If you export a binding from the global scope, you're supposed to get an error unless you create a local binding and export it with whatever name you want.

export { Math };
//       ~~~~
// Cannot export 'Math'. Only local declarations can be exported from a module.

However, we have a hole and allow exports that originate from a global augmentation. The following file is permitted with no error:

declare global {
    var XYZ: number;
}

export { XYZ };

Playground Link

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.