Skip to content

[api-extractor] Support string literals in named exports (e.g. export { foo as "module.exports" })Β #5549

@romainmenke

Description

@romainmenke

Summary

Support string literals in named exports (e.g. export { foo as "module.exports" })

Repro steps

Use '@microsoft/api-extractor' to bundle a list of type definition files.
One of which contains a string literal named export

Expected result:

https://www.typescriptlang.org/play/?ts=5.9.3#code/MYewdgzgLgBAZiEMC8MDkAjAhgJzQbgChCBTADwAcQdYBveRGLCdAWxABMBXAGxIDpyVGhDQwAvkA

declare const foo = "bar";
export { foo as 'module.exports' };

Actual result:

declare const foo = "bar";
export { foo as module.exports };

Details

See: https://joyeecheung.github.io/blog/2025/12/30/require-esm-in-node-js-implementers-tales/

Standard questions

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

Question Answer
@microsoft/api-extractor version? latest
Operating system? max
API Extractor scenario? rollups
Would you consider contributing a PR? No
TypeScript compiler version? latest
Node.js version (node -v)? latest

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    Status

    Needs triage

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions