[api-extractor] Canonical names are getting suffixed with `_2` unnecessarily.
Summary
When running the API extractor, my interface StorageManager and interface ImageData get suffixed with a _2 in their canonical names, however, their references remain the right name.
The source code is available at https://github.com/TheDrone7/shieldbow
The source code where I am getting the issue is available in the weird-docs branch - https://github.com/TheDrone7/shieldbow/tree/weird-docs
Even after bumping to the new version, it worked right a few times but suddenly started happening a couple of hours before this issue was created.
Repro steps
Fork the repo linked above.
Simply just run the API extractor and when I went to check the extracted json file, it had _2, can be confirmed by running the npm docs:gen script and then seeing the generated docs by running docs:dev.
Standard questions
Please answer these questions to help us investigate your issue more quickly:
| Question | Answer |
|---|---|
@microsoft/api-extractor version? |
7.29.0 |
| Operating system? | Arch Linux (Kernel 5.18.16) |
| API Extractor scenario? | docs (.api.json) |
| Would you consider contributing a PR? | Yes |
| TypeScript compiler version? | 4.7.4 |
Node.js version (node -v)? |
16.16.0 |
I'm unfortunately having a tough time repro-ing this. Here's what I did:
- Cloned the repo
- Checked out the
weird-docsbranch - Ran
npm install - Ran
npm run docs:gen
Only the docs/api/StatPerks.md file seems to be changing for me. No other changes. I've tried running npm run docs:gen about 10 separate times, and still no repro.
- OS: macOS Monterey 12.5
- Node.js version: v16.14.1
The code that suffixes names to make them unique is at https://github.com/microsoft/rushstack/blob/0a38e487b6f3e1a735efd3c28d27c107dad08dd9/apps/api-extractor/src/collector/Collector.ts#L479
That would be the first place to look for any indeterminism.
Since I was using a custom documents generator, I simply added a bypass for this right there as I could not figure this one out here but would definitely appreciate someone else taking a go at this cuz my document generator lookin a little sus rn.