microsoft / microsoft/TypeScript
No error when exporting from global augmentations
Open
@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 };
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.