microsoft / microsoft/TypeScript

Declaration file emits symbol property keys without importing them

Offen
#62,257 3 Kommentare 2 Reaktionen 3 zugewiesene Personen Auf GitHub ansehen

@DanielRosenwasser arbeitet bereits daran.

Seit 06.2.2026.

Bug Domain: Declaration Emit
Vorherrschende Sprache
Go
Sterne
111k
Forks
14.3k
Ø Merge
2 T. 4 Std.
Gemergte PRs (30 T.)
132

Beschreibung

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

import { fn } from 'test-pkg';
export const value = fn();

node_modules/test-pkg/index.d.ts:

declare const lostSymbol: unique symbol;
type lostSymbol = typeof lostSymbol;

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

declare function fn(): SomeGeneric<unknown>;

export {
    lostSymbol,
    fn
};
🙁 Actual behavior

dist/index.d.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:

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

Beitragsleitfaden

Beitragsleitfaden öffnen

Erste Schritte

  1. Lies das ganze Issue und danach den Beitragsleitfaden des Projekts.
  2. Schreib ins Issue, dass du es übernimmst — das erspart doppelte Arbeit.
  3. Forke das Repository und arbeite in einem Branch.
  4. Öffne einen Pull Request, der die Issue-Nummer nennt.

Bewertung

Dieses Issue wurde noch nicht bewertet.

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.