microsoft / microsoft/TypeScript

No error when exporting from global augmentations

オープン
#64,152 コメント 0 件 リアクション 1 件 担当者 2 名 GitHub で見る

@DanielRosenwasser がすでに取り組んでいます。

2026年9月4日 から。

  • #64162 @copilot-swe-agent による — オープン
Breaking Change Bug
主要言語
Go
スター
111k
フォーク
14.3k
平均マージ
2日 4時間
マージ済み PR(30日)
132

説明

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)

コントリビューションガイド

コントリビューションガイドを開く

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

評価

この issue はまだ評価されていません。

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。