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] Trimmed member from exported namespace still exported by namespace in rollup #2791

Closed
SchoofsKelvin opened this issue Jul 6, 2021 · 1 comment · Fixed by #2793

Comments

@SchoofsKelvin
Copy link
Contributor

SchoofsKelvin commented Jul 6, 2021

Summary

A namespace can export a member that gets trimmed away. If that namespace then gets exported, it still tries to export the trimmed member when generating the rollup.

Repro steps

Demo code:

// index.ts
import * as ns from './ns';
export { ns };

// ns.ts
/** @public */
export const PUBLIC = 'PUBLIC';

/** @internal */
export const INTERNAL = 'INTERNAL';

Expected result:

/** @public */
declare const PUBLIC = "PUBLIC";

declare namespace ns {
  export {
    PUBLIC
  }
}
export { ns }

Actual result:

/** @public */
declare const PUBLIC = "PUBLIC";

declare namespace ns {
  export {
    PUBLIC,
    INTERNAL
  }
}
export { ns }

As can be seen, while the declaration of INTERNAL is stripped, the namespace still tries to export it.

Details

Probably related to the recent import * as __ from __ feature (#1029/#1796) and maybe #1664?.

Standard questions

Please answer these questions to help us investigate your issue more quickly:

Question Answer
@microsoft/api-extractor version? 1.17.1
Operating system? Windows
API Extractor scenario? rollups (.d.ts)
Would you consider contributing a PR? Yes
TypeScript compiler version? 4.3.5
Node.js version (node -v)? 14.16.0
@j-ulrich
Copy link

I am experiencing the same issue with version 7.19.4.

@microsoft/api-extractor version? | 1.17.1

I guess there is something wrong because this version does not exist. :D

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants