microsoft / rushstack

Monorepo for tools developed by the Rush Stack community
https://rushstack.io/
Other
5.74k stars 587 forks source link

[api-extractor] `export default` of tagged API members are not correctly trimmed from API report variants #4775

Open Josmithr opened 3 weeks ago

Josmithr commented 3 weeks ago

Summary

Given an export pattern like the following:

/** @beta */
export interface Foo { ... }

export default Foo;

The expectation is that Foo exports would only appear in API report variants beta and alpha, but they incorrectly appear in all report variants like the following:

export { Foo }
export default Foo;

I have published a draft PR (https://github.com/microsoft/rushstack/pull/4774) that illustrates the issue by updating test assets.

Josmithr commented 3 weeks ago

@octogonz I'm happy to contribute a fix here, but I'll need some guidance on where to get started.

This seems to be specific to cases where an existing export is also exported via export default. E.g.,

/** @beta */
export interface Foo { ... }
export default Foo;

I was not able to repro it when the declaration is inline with the default export. E.g.,

export default interface Foo { ... };