Skip to content

Recognize export * as default as a syntactic default export for synthetic default detection#55985

Merged
andrewbranch merged 2 commits intomainfrom
bug/55829
Oct 5, 2023
Merged

Recognize export * as default as a syntactic default export for synthetic default detection#55985
andrewbranch merged 2 commits intomainfrom
bug/55829

Conversation

@andrewbranch
Copy link
Copy Markdown
Member

Fixes #55829

@typescript-bot typescript-bot added Author: Team For Milestone Bug PRs that fix a bug with a specific milestone labels Oct 4, 2023
return ((isExportAssignment(node) && !node.isExportEquals)
|| hasSyntacticModifier(node, ModifierFlags.Default)
|| isExportSpecifier(node)
|| isNamespaceExport(node));
Copy link
Copy Markdown
Member

@DanielRosenwasser DanielRosenwasser Oct 4, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is the following covered under these rules?

import * as yadda from "./yadda";
export { yadda as default };

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes (isExportSpecifier)

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This function is only called when the symbol attached to the declaration was reached by the name default, which is why these don’t check specifically check for defaultness.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It’s intended to distinguish between these ES module syntaxes and something like

export = {
  options: {},
  default: {},
}

@andrewbranch andrewbranch requested a review from weswigham October 5, 2023 00:25
@DanielRosenwasser
Copy link
Copy Markdown
Member

@typescript-bot test top200

@typescript-bot
Copy link
Copy Markdown
Collaborator

typescript-bot commented Oct 5, 2023

Heya @DanielRosenwasser, I've started to run the diff-based top-repos suite on this PR at d3ebc25. You can monitor the build here.

Update: The results are in!

@typescript-bot
Copy link
Copy Markdown
Collaborator

@DanielRosenwasser Here are the results of running the top-repos suite comparing main and refs/pull/55985/merge:

Everything looks good!

Copy link
Copy Markdown

@robpalme robpalme left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM - thank you for the quick fix!

@andrewbranch andrewbranch merged commit 21109b7 into main Oct 5, 2023
@andrewbranch andrewbranch deleted the bug/55829 branch October 5, 2023 17:33
@microsoft microsoft locked as resolved and limited conversation to collaborators Oct 22, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

Author: Team For Milestone Bug PRs that fix a bug with a specific milestone

Projects

None yet

Development

Successfully merging this pull request may close these issues.

export * as default in declaration file loses members

4 participants