microsoft / microsoft/TypeScript
`export { _void as void }` leads to exporting duplicate identifiers
まだ誰も着手していません。
- 主要言語
- Go
- スター
- 111k
- フォーク
- 14.3k
- 平均マージ
- 2日 4時間
- マージ済み PR(30日)
- 132
説明
### 🔎 Search Terms
`export void` `export reserved` `export null`
### 🕗 Version & Regression Information
- Reproducible since typescript v4. In older releases, it doesn't export anything. I also tried the latest dev release (5.9.0-dev.20250716)
- This is the behavior in every version I tried, and I reviewed the FAQ for entries about `exports`
### ⏯ Playground Link
[Playground (important: lang:javascript)](https://www.typescriptlang.org/play/?target=99&jsx=0&filetype=js#code/FAUwHgDg9gTgLgAgMZQHYGdEH0BuUCWAJggLwIDeAvsKJLIuQrgcQIboJ5EKUI1A)
### 💻 Code
Using the following `tsconfig.json`:
```json
{
"compilerOptions": {
"target": "esnext",
"lib": ["esnext"],
"module": "esnext",
"allowJs": true,
"checkJs": true,
"declaration": true,
"declarationMap": true,
"outDir": "./dist",
"emitDeclarationOnly": true,
"strict": true,
"noImplicitAny": true,
"moduleResolution": "bundler"
}
}
```
I compile declaration files for this code `${project}/schema.js` (only happens when compiling javascript):
```ts
const _null = {}
const $void = {}
export { _null as null, $void as void }
```
### 🙁 Actual behavior
The produced declaration file `schema.d.ts` is erroneous. It has duplicate identifiers:
```ts
declare const _null: {};
declare const $void: {};
export { _null as null, _null as null, $void as void, _void as void };
```
### 🙂 Expected behavior
No duplicate identifiers:
```ts
declare const _null: {};
declare const $void: {};
export { _null as null, $void as void };
```
### Additional information about the issue
For any reserved keyword, `tsc` always exports `_{reserved} as {reserved}`, whenever `{reserved}` is exported. Even though the variable `_{reserved}` does not exist.
It is only reproducible when compiling javascript.
コントリビューションガイド
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
調査の方向性
提供された tsconfig.json と schema.js の再現から始め、続いて export リストについて JavaScript の宣言のみの emit を調査します。生成された schema.d.ts を想定される export 文と比較します。予約語の export が 1 回だけ現れ、存在しない識別子が emit されなければ完了です。
索引モデルが issue の本文から書いたものです。
評価
- 技術スタック
- javascript, typescript
- 領域
- compilers
- issue の種類
- バグ
- 難易度
- 4/5
- 見積もり時間
- 3〜5日
- 活発さ
- 停滞
- 明瞭さ
- 明確に書かれている
- 初心者へのやさしさ
- 45/100