Skip to content

Conversation

@weswigham
Copy link
Member

@weswighamweswigham commented Feb 27, 2020

We need this because now that __createBinding is used by __exportStar to create live-updating getters, if you had input like

export*from"mod";exportconstnameFromMod=0;

we'd output

__exportStar(exports,require("mod"));exports.nameFromMod=0;

the assignment will throw because the __exportStar made a getter which can't be overridden with a simple assignment. By emitting

exports.nameFromMod=void0;__exportStar(exports,require("mod"));exports.nameFromMod=0;

we prevent __exportStar from overwriting nameFromMod with a getter (so the assignment succeeds).

This also neatly ensures all export names are available to reexport when resolving within a circular module graph.

Copy link
Contributor

@rbucktonrbuckton left a comment

Choose a reason for hiding this comment

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

May need to discuss in design meeting.

@YowaiCoder
Copy link

Missed the case of exported namespace (export * as foo from 'foo').

@RobertLowe
Copy link

Curious, this violates no-voidhttps://eslint.org/docs/2.0.0/rules/no-void

@microsoftmicrosoft locked as resolved and limited conversation to collaborators Oct 21, 2025
Sign up for freeto subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants

@weswigham@YowaiCoder@RobertLowe@rbuckton@typescript-bot