[api-extractor] `Internal Error: "Unable to analyze the export \"default\"" when re-exporting default from .d.cts module that uses export =`
@octogonz đang làm issue này rồi.
Từ ngày 23/3/2026.
Đánh giá
Issue này chưa được đánh giá.
Mô tả
Summary
I am trying to run API Extractor on declarations that include a re-export of default from a .d.cts file that uses export =.
API Extractor throws an internal error instead of analyzing the export.
The failure is reproducible in a minimal project with only two declaration files.
Repro steps
- Create a clean repro folder and files:
mkdir api-extractor-export-equals-repro
cd api-extractor-export-equals-repro
package.json
{
"name": "api-extractor-export-equals-repro",
"version": "0.0.0",
"private": true,
"devDependencies": {
"@microsoft/api-extractor": "7.57.6",
"typescript": "5.9.3"
}
}
tsconfig.json
{
"compilerOptions": {
"target": "ES2022",
"module": "NodeNext",
"moduleResolution": "NodeNext",
"strict": true,
"skipLibCheck": true
},
"include": ["./**/*"]
}
api-extractor.json
{
"$schema": "https://developer.microsoft.com/json-schemas/api-extractor/v7/api-extractor.schema.json",
"mainEntryPointFilePath": "<projectFolder>/index.d.ts",
"bundledPackages": [],
"compiler": {
"tsconfigFilePath": "<projectFolder>/tsconfig.json"
},
"apiReport": {
"enabled": false,
"reportFolder": "<projectFolder>/etc"
},
"docModel": {
"enabled": false
},
"dtsRollup": {
"enabled": false
},
"tsdocMetadata": {
"enabled": false
},
"messages": {
"compilerMessageReporting": {
"default": { "logLevel": "warning" }
},
"extractorMessageReporting": {
"default": { "logLevel": "warning" }
},
"tsdocMessageReporting": {
"default": { "logLevel": "warning" }
}
}
}
index.d.ts
export { default as ar } from "./ar.cjs";
ar.d.cts
import type * as errors from "./errors.cjs";
declare function _default(): { localeError: errors.Error };
export = _default;
errors.d.cts
export interface Error {
code: string;
}
- Install and run:
npm install
npx api-extractor run --diagnostics --local --config ./api-extractor.json
Expected result: API Extractor should analyze the export successfully (or emit a normal diagnostic if unsupported), but should not crash with an internal error.
Actual result: API Extractor throws:
ERROR: Internal Error: Unable to analyze the export "default" in
.../ar.d.cts
You have encountered a software defect. Please consider reporting the issue to the maintainers of this application.
(Also prints: Analysis will use the bundled TypeScript version 5.9.3.)
Details
This looks like a default re-export resolution bug for .d.cts modules that use export =.
In this repro:
index.d.tsusesexport { default as ar } from "./ar.cjs"- target declaration
ar.d.ctsusesexport = _default
TypeScript models export = differently from default, and API Extractor appears to throw while resolving this path instead of mapping/handling it.
I also observed the same failure with @microsoft/api-extractor@7.57.7.
Standard questions
Please answer these questions to help us investigate your issue more quickly:
| Question | Answer |
|---|---|
@microsoft/api-extractor version? |
7.57.6 (also reproducible on 7.57.7) |
| Operating system? | Mac (Darwin) |
| API Extractor scenario? | rollups (.d.ts) |
| Would you consider contributing a PR? | Yes |
| TypeScript compiler version? | 5.9.3 (bundled by API Extractor in diagnostics output) |
Node.js version (node -v)? |
v24.13.0 |
- Ngôn ngữ chính
- TypeScript
- Star
- 6.5k
- Fork
- 708
- Merge trung bình
- 5 ngày 19 giờ
- Pull request đã merge (30 ngày)
- 48
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
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- 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.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của microsoft/rushstack
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 65/100
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 70/100
-
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 48/100
Tất cả issue của microsoft/rushstack
Issue tương tự
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
vercel-labs/just-bash#464 ·
-
looksLikeSlug() is ASCII-only, so non-Latin entity slugs (e.g. Korean) skip exact match and collapse Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 65/100
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 65/100
-
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 90/100
TanStack/tanstack.com#1293 ·