microsoft / microsoft/TypeScript

Declaration file emits symbol property keys without importing them

Đang mở
#62,257 3 bình luận 2 reaction 3 người được giao Xem trên GitHub

@DanielRosenwasser đang làm issue này rồi.

Từ ngày 6/2/2026.

Bug Domain: Declaration Emit
Ngôn ngữ chính
Go
Star
111k
Fork
14.3k
Merge trung bình
2 ngày 4 giờ
Pull request đã merge (30 ngày)
132

Mô tả

🔎 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

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Đánh giá

Issue này chưa được đánh giá.

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.