Skip to content

[api-extractor] Trimmed member from exported namespace still exported by namespace in rollup #2791

Closed

Description

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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions