microsoft / microsoft/TypeScript

Declaration file emits symbol property keys without importing them

オープン
#62,257 コメント 3 件 リアクション 2 件 担当者 3 名 GitHub で見る

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

2026年2月6日 から。

Bug Domain: Declaration Emit
主要言語
Go
スター
111k
フォーク
14.3k
平均マージ
2日 4時間
マージ済み PR(30日)
132

説明

### 🔎 Search Terms

missing import in d.ts, symbol key not imported, unique symbol dts emit, dataTagSymbol not found, declaration file missing import

### 🕗 Version & Regression Information

- This is the behavior in every version I tried, and I reviewed the FAQ for entries about "Behavior That Looks Wrong (And Arguably Is) But Is Currently Working As Intended"
- This bug is reproducible in the latest stable (`5.9.2`), and still occurs in `next` (`6.0.0-dev.20250811`)

### ⏯ Playground Link

https://stackblitz.com/edit/stackblitz-starters-vflvduch?file=src%2Findex.ts

### 💻 Code

Here's the code from the Stackblitz reproduction above.

src/index.ts:
```ts
import { fn } from 'test-pkg';
export const value = fn();
```

node_modules/test-pkg/index.d.ts:
```ts
declare const lostSymbol: unique symbol;
type lostSymbol = typeof lostSymbol;

type SomeGeneric = {
[lostSymbol]: T;
};

declare function fn(): SomeGeneric;

export {
lostSymbol,
fn
};
```

### 🙁 Actual behavior

dist/index.d.ts:
```ts
export declare const value: {
[lostSymbol]: unknown; // lostSymbol is not defined here and errors on the consumer's type check
};
```

### 🙂 Expected behavior

dist/index.d.ts:
```ts
import { lostSymbol } from 'test-pkg'; // should import from pacakge

export declare const value: {
[lostSymbol]: unknown;
};
```

### Additional information about the issue

Related?: https://github.com/microsoft/TypeScript/issues/49065

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

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

はじめの一歩

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

評価

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

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

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