-
Notifications
You must be signed in to change notification settings - Fork 647
Description
Summary
When trying to run api-extractor on a project that attempts to bundle the axe-core library, api-extractor fails with the message:
ERROR: Internal Error: Unable to analyze the export "AxeResults" in /node_modules/axe-core/axe.d.ts
You have encountered a software defect. Please consider reporting the issue to the maintainers of this application.
I maintain the axe-core library and am wondering what about the type definition file is causing the issue. I'm hoping to work on either fixing it there or help fix it in this project. The project uses a namespace declaration and an export =
syntax, but testing both those in a small test seems to work just fine. The axe-core type definition file is valid TypeScript syntax as far as I'm aware and can be used in a TypeScript project as expected.
Repro steps
Create a new project that imports something from the axe-core library (e.g. AxeResults
)
import type { AxeResults } from "axe-core";
export function analyze(): AxeResults {
return {} as AxeResults;
}
Set the bundledPackages
to bundle axe-core
:
"bundledPackages": ["axe-core"]
Run typescript then api-extractor
$ tsc
$ api-extractor run --local --diagnostics
Details
Package.json
{
"typings": "./dist/index.d.ts",
"devDependencies": {
"@microsoft/api-extractor": "^7.52.9",
"axe-core": "^4.10.3",
"typescript": "^5.8.3"
},
"name": "test",
"version": "1.0.0",
"main": "dist/index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"author": "",
"license": "ISC",
"description": ""
}
tsconfig.json
{
"compilerOptions": {
"target": "es2020",
"module": "commonjs",
"lib": ["dom", "es2020"],
"declaration": true,
"sourceMap": true,
"outDir": "dist",
"rootDir": "src",
"removeComments": true,
"pretty": true,
"strict": true,
"noImplicitAny": true,
"noImplicitThis": true,
"noImplicitReturns": true,
"moduleResolution": "node",
"esModuleInterop": true,
"skipLibCheck": true
},
"include": ["src"]
}
Standard questions
Please answer these questions to help us investigate your issue more quickly:
Question | Answer |
---|---|
@microsoft/api-extractor version? |
7.52.9 |
Operating system? | Mac |
API Extractor scenario? | rollups (.d.ts) |
Would you consider contributing a PR? | Maybe? |
TypeScript compiler version? | 5.8.3 |
Node.js version (node -v )? |
22.14.0 |
Metadata
Metadata
Assignees
Labels
Type
Projects
Status