Skip to content
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] Exports which shadow built-ins are included in incorrect report variants #4762

Open
Josmithr opened this issue Jun 5, 2024 · 3 comments
Labels
bug Something isn't working as intended effort: easy Probably a quick fix. Want to contribute? :-)

Comments

@Josmithr
Copy link
Contributor

Josmithr commented Jun 5, 2024

In cases where API exports are aliased to avoid collisions with built-ins, export statements are surfaced in all API report variants regardless of release tag.

This was not an issue prior to the reportVariants feature, but there are now cases where exports that are aliased to avoid conflicts with built-ins result in export statements being included in reports of incorrect release variants.

See this draft PR for a repro of the issue: #4761

@Josmithr
Copy link
Contributor Author

Josmithr commented Jun 5, 2024

@octogonz I'm wondering if you can point me in the right direction here in terms of resolution. I believe the export { Foo_2 as Foo } items end up being included because they are not annotated with a release tag, and the code determining what should belong in the different report variants implicitly treats untagged items as @public. Perhaps those checks need to be more nuanced to account for this situation? Or perhaps in these cases the release tag should be copied along from the underlying (aliased) declaration?

@Josmithr Josmithr changed the title [api-extractor] [api-extractor] Exports which shadow built-ins are included in incorrect report variants Jun 6, 2024
@octogonz octogonz added bug Something isn't working as intended effort: easy Probably a quick fix. Want to contribute? :-) labels Nov 1, 2024
@octogonz
Copy link
Collaborator

octogonz commented Nov 1, 2024

api-extractor-lib2-test/src/index.ts looks like this:

/**
 * Shadows of built-ins get aliased during rollup, which has resulted in tags being ignored when determining correct
 * output for report variants.
 * @internal
 */
export const performance: Performance = globalThis.performance;

The generated api-extractor-lib2-test.api.md looks like this:

// @internal
const performance_2: Performance;
export { performance_2 as performance }

The bug is that api-extractor-lib2-test.public.api.md gets partially trimmed like this:

export { performance_2 as performance }

@octogonz
Copy link
Collaborator

octogonz commented Nov 1, 2024

@Josmithr could you build this test project with .d.ts trimming enabled, and determine whether this affects the .d.ts rollup as well? If so, this is a higher priority issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working as intended effort: easy Probably a quick fix. Want to contribute? :-)
Projects
Status: Needs triage
Development

No branches or pull requests

2 participants