-
Notifications
You must be signed in to change notification settings - Fork 598
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[api-extractor] Internal Error: Unable to follow symbol for "const" on first api-extractor run #3875
Comments
I also tried with node v16.19.0, and a completely clean install. Same error. |
I have the same issue in my project. It seems that API extractor is be unable to parse |
Also encountered this error. In my case, the cause was due to imports of type As requested in AstSymbolTable.ts, I have tagged the commit in my Github repository where this error occurs. Tag is api-extractor-error. This error can be reproduced by:
This should generate the error. The subsequent commit removes the relevant |
Sorry nobody looked at this until now. I was able to confirm the repro from this issue's description. (I haven't tried @pbklink's repro yet.) The problem is caused by the {
"extends": "@tsconfig/node16-strictest/tsconfig.json",
"compilerOptions": {
"outDir": "./dist/",
"noImplicitAny": true,
"strict": true,
"rootDir": "./src",
"baseUrl": "src", 👈👈👈 This setting enables the following sort of import: api-extractor-issue/src/boundaries/index.ts
Normally the module resolver would interpret The The problem is that these remappings exist in tsconfig.json for your library project, but are generally NOT visible to the tsconfig.json used to build other projects that consume your library. (There is a proper way to define mappings in package.json, but that is a separate topic, with its own pitfalls.) Now, API Extractor does actually consult your tsconfig.json when analyzing your project, but by design it tries to analyze your project as an external consumer would. In other words, it analyzes And so the bug is that So while we would probably NOT want to support
In short, this repo's tsconfig.json is using an compiler configuration that is nonstandard and cannot generalize to the professional library development situations that API Extractor focuses on, so my recommendation is to fix the tsconfig.json to use standard imports, and then the crash will go away. |
Aha! Thanks for the explanation. I thought I had fixed the exports so that external consumers can use it appropriately, but perhaps I didn't. I remember looking in to that problem at length.
This definitely wasn't clear to me! I really like your three improvement steps. |
Update: It turns out I fixed it by removing that |
I'm experiencing the same problem in my repository FacilMap/facilmap. How to reproduce: Check out the repository at tag After some investigation, I found the cause to be one specific |
Summary
When following the setup steps here, I encountered:
Repro steps
Because this happened on my first ever use of this tool, I haven't tried to make a minimal repro. However, I can point you at the repository that has this error.
Check out the
api-extractor-issue
branch of this repository, donpm install && npm run build
and then run eithernpm run api-extractor
, ornpx api-extractor run --local --diagnostics
Expected result: No errors.
Actual result: as above. The end of the error message with
--diagnostics
is:As instructed, I am reporting it 😎
Details
api-extractor init
is not right - for example, I had to change the/lib/
to/dist/
. It would be awesome if the init would parse the tsconfig and set that setting (and any others) appropriately. I had a skim read of the settings, but couldn't see anything obviously wrong.Standard questions
Please answer these questions to help us investigate your issue more quickly:
@microsoft/api-extractor
version?node -v
)?The text was updated successfully, but these errors were encountered: