Hacktoberfest 2026: những issue maintainer đã đánh dấu cho tháng Mười, đang mở và phù hợp người mới. Xem issue Hacktoberfest

[api-extractor] Fails to parse `bundledPackages` declarations from dir import

Đang mở
#5,412 1 bình luận 1 reaction 0 người được giao Xem trên GitHub

Chưa có ai nhận issue này.

Đánh giá

Độ khó
3/5
Thời gian dự kiến
1-2 ngày
Mức phù hợp với người mới
48/100
Loại issue
Lỗi
Độ rõ ràng
Đặc tả rõ ràng
Mức độ hoạt động
Đình trệ
Công nghệ
typescript
Lĩnh vực
tooling

Hướng nghiên cứu

Start in ExportAnalyzer.ts, focusing on TypeScriptInternals.getResolvedModule and how the resolved module data is used for bundledPackages checks. Use the linked reproduction repository with the bundledPackages and directory-import example, then verify that the generated declaration contains an inlined export declaration rather than an import from './bar-dir'.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

Summary

When using bundledPackages options, import declaration from dir generates incorrect dts result.

e.g. configure "bundledPackages": ["foo"], with following foo package files:

  • index.d.ts
    export { Bar } from './bar-dir';
    
  • bar-dir/index.d.ts
    export interface Bar {}
    

and following entry dts file:

export * from "foo";

generates dts result:

import { Bar } from './bar-dir';
export { Bar }

Repro steps

Expected result:

Previous example should generate:

export declare interface Bar {}

or reproduce by: https://github.com/adventure-yunfei/api-extractor-issue--bundledPackages

Details

Debugged and found the reason, introduced by #3321. For import declaration from dir (e.g., import { A } from "./a", while resolved file is a/index.d.ts), TypeScriptInternals.getResolvedModule (in ExportAnalyzer.ts) returns the result without packageId data, thus bundledPackages check is skipped (cause bug here).

Standard questions

Please answer these questions to help us investigate your issue more quickly:

Question Answer
@microsoft/api-extractor version? 7.53.1
Operating system? Mac
API Extractor scenario? rollups (.d.ts)
Would you consider contributing a PR? No
TypeScript compiler version? 5.8.2
Node.js version (node -v)? v16.20.0
Ngôn ngữ chính
TypeScript
Star
6.5k
Fork
708
Merge trung bình
4 ngày 13 giờ
Pull request đã merge (30 ngày)
62

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

Chưa lập chỉ mục được hướng dẫn đóng góp cho kho mã nguồn này

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.

Issue khác của microsoft/rushstack

Tất cả issue của microsoft/rushstack

Issue tương tự

Thêm issue về TypeScript

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.