microsoft / microsoft/TypeScript
No error when exporting from global augmentations
@DanielRosenwasser đang làm issue này rồi.
Từ ngày 4/9/2026.
- #64162 của @copilot-swe-agent — đang mở
- Ngôn ngữ chính
- Go
- Star
- 111k
- Fork
- 14.3k
- Merge trung bình
- 2 ngày 4 giờ
- Pull request đã merge (30 ngày)
- 132
Mô tả
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.
```ts
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:
```ts
declare global {
var XYZ: number;
}
export { XYZ };
```
[Playground Link](https://www.typescriptlang.org/play/?#code/CYUwxgNghgTiAEBzCB7ARlC8DeAoeB8AbrPABoCaAWgFzwB2ArgLZogwDcuAvrriAA8ADihgAXHOWrxuHIA)
Hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Đánh giá
Issue này chưa được đánh giá.