-
Notifications
You must be signed in to change notification settings - Fork 595
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] Class/interface with the same name as something from lib.dom is renamed #2976
Comments
I noticed when running with --diagnostics lines like this:
which would have come from something like this:
Here, |
Looking into the source code I see this occurs inside
Why does the global name "win" if the name of something in my package, whose API we are currently documenting, happens to match a global symbol? This doesn't seem to make any sense. I am currently running the API extractor with that global check removed:
and I don't have the problem with my symbols being rewritten. I know of course that I have also removed the check against me exporting a symbol with the name |
This is the change that added this code: Is there a record somewhere of what instigated this change? |
This is caused by global name conflict. BTW I'm not sure why your dts rollup result is also wrong. // index.d.ts
export class Selection {
} generates correct dts-rollup result: declare class Selection_2 {
}
export { Selection_2 as Selection }
export { } You may try again. Note that api-extractor accepts .d.ts files, not .ts files. Your repro example is not. |
Ok, that's interesting - I do see
and also after backing out my change and running it again I can't reproduce the error of However, the apidocs have files like this:
|
As I said, api doc has a bug. You can try my fix. |
ok yes this is a duplicate of #2534. closing. thanks for the feedback. |
Summary
If you have this class, for instance:
you'll get a class called
Selection_2
in your apidocs.In the
.d.ts
rollup file it will be renamed to this:This also happens with a class in my project called
Node
- it comes out asNode_2
. BothNode
andSelection
are names that lib.dom exports.Repro steps
compilerOptions
intsconfig.json
make sure you're importingdom
:If I run with
--diagnostics
I can see that the api-extractor processes a whole bunch of .d.ts files in node_modules; I don't know if this is to be expected or not.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: