[api-extractor] "ERROR: Internal Error: Unable to analyze the export" when using `var`
Nobody has claimed this yet.
Assessment
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Newbie friendliness
- 38/100
- Issue type
- Bug
- Clarity
- Mostly clear
- Activity status
- Stale
- Tech stack
- typescript
- Domain
- tooling
Research direction
Start with the linked minimal reproduction, tale-of-export-var-and-api-extractor, and run API Extractor against its exported var declaration using the reported TypeScript and Node.js versions. Trace the API Extractor analysis path that produces the reported internal error; done means the reproduction succeeds and the exported variable is handled without that error.
Written by the indexing model from the issue text.
Description
Summary
I want to run api-extractor on a package interface which includes exported var values, which in d.ts manifest as
export declare var __name__: __type__
Repro steps
Minimal repro:
https://github.com/kuhe/tale-of-export-var-and-api-extractor
Expected result:
API extractor succeeds.
Actual result:
Error message:
ERROR: Internal Error: Unable to analyze the export "zero" in
/Users/***/workspace/tale-of-declare-var-and-api-extractor/lib/index.d.ts
You have encountered a software defect. Please consider reporting the issue to the maintainers of this application.
Details
Perhaps the initial reaction will be, like in https://github.com/microsoft/rushstack/issues/3353, that export var is not "recommended".
But I think that should not be up to this library, but rather the user. My team had started using api-extractor for documentation, and now find that we are unable to export vars, but unable to remove api-extractor as a dependency at the moment.
As a workaround, we will likely convert the vars into consts or lets, but shouldn't have to.
Standard questions
Please answer these questions to help us investigate your issue more quickly:
| Question | Answer |
|---|---|
@microsoft/api-extractor version? |
7.55.2 |
| Operating system? | Linux |
| API Extractor scenario? | docs (.api.json) |
| Would you consider contributing a PR? | Yes, if confirmed as unintentional |
| TypeScript compiler version? | 5.9.3 |
Node.js version (node -v)? |
20.5.1 |
- Dominant language
- TypeScript
- Stars
- 6.5k
- Forks
- 708
- Avg merge
- 4d 13h
- Merged PRs (30d)
- 62
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from microsoft/rushstack
-
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 65/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 70/100
-
Difficulty 4/5 3-5 days Newbie friendliness 45/100
All issues in microsoft/rushstack
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
bcgov/bc-wallet-mobile#4761 · 1 comment ·
-
external-issue to-triage
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
-
area-deployment area-integrations triage:bot-seen
Difficulty 2/5 Half a day Newbie friendliness 86/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
-
refactor
Difficulty 2/5 1-3 hours Newbie friendliness 84/100