Skip to content

[api-extractor] global declaration is getting deleted #3898

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

Open
slavafomin opened this issue Jan 17, 2023 · 3 comments
Open

[api-extractor] global declaration is getting deleted #3898

slavafomin opened this issue Jan 17, 2023 · 3 comments

Comments

@slavafomin
Copy link

Summary

Hello!

I'm working on a polyfill and I have the following global declaration in my src/index.ts:

declare global {
  interface JSON {
    parse<Type = any>(text: string, reviver?: ReviverFunc): Type;
  }
}

It augments the JSON interface by extending the parse function signature. This declaration is getting effectively emitted to the index.d.ts generated by tsc. However, the API Extractor removes it from the resulting index.d.ts for some reason.

Repro steps

Expected result:

The declare global declaration should be added to the resulting index.d.ts file.

Actual result:

The declare global declaration is not added to the resulting index.d.ts file.

Details

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? Ubuntu Linux
API Extractor scenario? rollups (.d.ts)
Would you consider contributing a PR? No
TypeScript compiler version? 4.9.4
Node.js version (node -v)? 18.12.1
@alSergey
Copy link

Hi, I have a similar problem. Are there any solutions?

@alSergey
Copy link

@slavafomin hi, did you find any solution to this problem?

@niedzielski
Copy link

Possible dup of #1709.

@iclanton iclanton moved this to Needs triage in Bug Triage Oct 2, 2023
@iclanton iclanton moved this from Needs triage to AE/AD in Bug Triage Feb 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: AE/AD
Development

No branches or pull requests

3 participants