Skip to content

5.5.0 regression - Named exports of functions are not emitted for CommonJS #58473

Description

🔎 Search Terms

commonjs export

🕗 Version & Regression Information

  • This changed between versions 5.4.5 and 5.5.0

⏯ Playground Link

https://www.typescriptlang.org/play/?target=7&module=1&isolatedModules=true&verbatimModuleSyntax=false&ts=5.5.0-beta#code/GYVwdgxgLglg9mABMOcAUBKAXIgbnGAE0QG8AoAXzLIFMAPABzgCcpSzFPlUAaSgbjJA

💻 Code

functionfoo(): void{}export{foo,};

🙁 Actual behavior

ts 5.5.0-beta and 5.5.0-dev-20240508 both emit:

"use strict";Object.defineProperty(exports,"__esModule",{value: true});exports.foo=void0;functionfoo(){}

note missing last line

🙂 Expected behavior

ts 5.4.5 emit

"use strict";Object.defineProperty(exports,"__esModule",{value: true});exports.foo=void0;functionfoo(){}exports.foo=foo;

Additional information about the issue

No response

Metadata

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