Skip to content

Emit bug: default export is missing when exporting type+named+default #43359

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

Closed
robpalme opened this issue Mar 24, 2021 · 0 comments · Fixed by #44718
Closed

Emit bug: default export is missing when exporting type+named+default #43359

robpalme opened this issue Mar 24, 2021 · 0 comments · Fixed by #44718
Assignees
Labels
Bug A bug in TypeScript Fix Available A PR has been opened for this issue Rescheduled This issue was previously scheduled to an earlier milestone

Comments

@robpalme
Copy link

robpalme commented Mar 24, 2021

Bug Report

When using a single identifier to export three things (a type, a named export, and a default export) the default export is dropped from the emitted JS.

🔎 Search Terms

"default export" skipped dropped elided omitted forgotten "JS emit" type "named export" "JS+types"

🕗 Version & Regression Information

  • This is the behavior in every version I tried

⏯ Playground Link

Playground link with relevant code

💻 Code

type X = number;
export const X = 1;
export default X;

The problem is equally replicable with interface and object types.

🙁 Actual behavior

JS semantics are not preserved in the JS emit:

export const X = 1;

🙂 Expected behavior

export const X = 1;
export default X;

Credit

This bug was discovered by @ollupac

@RyanCavanaugh RyanCavanaugh added the Bug A bug in TypeScript label Mar 24, 2021
@RyanCavanaugh RyanCavanaugh added this to the TypeScript 4.3.1 milestone Mar 24, 2021
@RyanCavanaugh RyanCavanaugh added the Rescheduled This issue was previously scheduled to an earlier milestone label Jun 18, 2021
@typescript-bot typescript-bot added the Fix Available A PR has been opened for this issue label Jun 24, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug A bug in TypeScript Fix Available A PR has been opened for this issue Rescheduled This issue was previously scheduled to an earlier milestone
Projects
None yet
5 participants