Skip to content

[api-extractor] Internal Error: Unable to follow symbol for "const" on first api-extractor run #3875

Open
@TimothyJones

Description

@TimothyJones

Summary

When following the setup steps here, I encountered:

$  npx api-extractor run

api-extractor 7.33.7  - https://api-extractor.com/

Using configuration from ./api-extractor.json
Analysis will use the bundled TypeScript version 4.8.4

ERROR: Internal Error: Unable to follow symbol for "const"
You have encountered a software defect. Please consider reporting the issue to the maintainers of this application.

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, do npm install && npm run build and then run either npm run api-extractor, or npx api-extractor run --local --diagnostics

Expected result: No errors.

Actual result: as above. The end of the error message with --diagnostics is:

/Users/home/office/maintainer/case/node_modules/@types/stack-utils/index.d.ts
/Users/home/office/maintainer/case/node_modules/@types/yargs-parser/index.d.ts
/Users/home/office/maintainer/case/node_modules/@types/yargs/index.d.ts
============================================================

Ignoring reference to global variable "Array" in /Users/home/office/maintainer/case/src/connectors/contract/CaseContract.ts:43:13
Ignoring reference to global variable "Promise" in /Users/home/office/maintainer/case/src/connectors/contract/CaseContract.ts:46:6
Ignoring reference to global variable "Record" in /Users/home/office/maintainer/case/src/connectors/contract/structure/types.ts:6:18

ERROR: Internal Error: Unable to follow symbol for "const"
You have encountered a software defect. Please consider reporting the issue to the maintainers of this application.

As instructed, I am reporting it 😎

Details

  • I've tried to pin the typescript version to 4.8.4, but it didn't help (originally I was using 4.8.3).
  • It's possible that the autogenerated config file from 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.
  • As far as I know, my tsconfig is set up correctly, and I'm not doing anything weird or advanced with the types. Of course, I might be wrong about this ;)
  • It would be an improvement if the error message that asks to report it to the maintainers pointed to this repository - it's not obvious at first that this is the place to report api-extractor issues.

Standard questions

Please answer these questions to help us investigate your issue more quickly:

Question Answer
@microsoft/api-extractor version? 7.33.7
Operating system? macOS 11.6.4, M1 mac
API Extractor scenario? Following the getting started instructions
Would you consider contributing a PR? Not at this time
TypeScript compiler version? 4.8.4
Node.js version (node -v)? v18.9.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    repro confirmedThe issue comments included repro instructions, and the maintainers reproduced the problem

    Type

    No type

    Projects

    Status

    AE/AD

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions