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] Unable to analyze the export "Seq" when bundling immutable v5

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

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

Đánh giá

Độ khó
4/5
Thời gian dự kiến
3-5 ngày
Mức phù hợp với người mới
58/100
Loại issue
Lỗi
Độ rõ ràng
Khá rõ ràng
Mức độ hoạt động
Ít trao đổi
Công nghệ
node.js, typescript
Lĩnh vực
build-system, tooling

Hướng nghiên cứu

Start with API Extractor's ExportAnalyzer._getExportOfAstModule and reproduce the failure using immutable@5.1.5, TypeScript 5.7.3, and the entry declaration described in the issue. Compare how Seq and its nested namespaces are resolved against immutable@4.x; done means the bundled .d.ts rollup succeeds and inlines immutable's declarations without the internal export-analysis error.

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

Mô tả

Summary

@microsoft/api-extractor crashes with an internal error when immutable (v5) is listed in bundledPackages. The crash happens during analysis of the Seq export and is reproducible against an unmodified immutable@5.1.5 install.

This blocks distributing a self-contained .d.ts rollup for any consumer that re-exports types from immutable v5. The same project bundled immutable@4.x without issue, so the regression is on the Immutable v5 declaration shape.

Repro steps

  1. npm i immutable@5.1.5 @microsoft/api-extractor@7.58.7 typescript@5.7.3

  2. Create an entry .d.ts that re-exports something from immutable, e.g.:

    import type { List } from 'immutable'
    export declare function getList(): List<string>
    
    
  3. In api-extractor.json set "bundledPackages": ["immutable"].

  4. Run api-extractor run --local --diagnostics.

Expected result: API Extractor inlines Immutable's declarations into the rollup, as it does for immutable@4.x.

Actual result:

ERROR: Internal Error: Unable to analyze the export "Seq" in node_modules/immutable/dist/immutable.d.ts

You have encountered a software defect. Please consider reporting the issue to the maintainers of this application.
Error: API Extractor failed with exit code 1

Details

The Immutable v5 declaration uses the same overall shape as v4 (declare namespace Immutable { … } export = Immutable; export as namespace Immutable;), but Seq and its nested namespaces (Seq.Keyed, Seq.Indexed, Seq.Set) are declared in a way that ExportAnalyzer._getExportOfAstModule can't resolve.

Workaround we ended up using: remove immutable from bundledPackages, let API Extractor emit import … from 'immutable', then post-process the rollup with a small script that inlines the namespace and rewrites the renamed imports (Immutable_2, Map_3, Set_2, …) to local aliases of the inlined namespace. Happy to share if it helps reproduce.

Related to (but distinct from) #2220, #1972, #5507, #5694. Those all surface the same generic "Unable to analyze the export" error from different triggers.

Standard questions

Question Answer
@microsoft/api-extractor version? 7.58.7
Operating system? macOS (also reproduces in Linux CI)
API Extractor scenario? rollups (.d.ts)
Would you consider contributing a PR? No (unfamiliar with ExportAnalyzer internals)
TypeScript compiler version? 5.7.3
Node.js version (node -v)? v24.13.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.