microsoft / microsoft/TypeScript

Declaration file emits symbol property keys without importing them

Open
#62,257 3 comments 2 reactions 3 assignees View on GitHub

@DanielRosenwasser is already working on this.

Since Feb 6, 2026.

Bug Domain: Declaration Emit
Dominant language
Go
Stars
111k
Forks
14.3k
Avg merge
2d 4h
Merged PRs (30d)
132

Description

### 🔎 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

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.