-
Notifications
You must be signed in to change notification settings - Fork 12.8k
Fix namespace import/export helper usage under '--esModuleInterop' #39490
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
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should also make sure #34903 is on our radar, since the fix for that'll touch some of the same stuff in the same ways (so we should probably try to fix near the same time), since the bug is similar but with export {a,b} from "ns"
instead of export * as a from "ns"
.
I'm looking into rolling a fix for #35800 into this as well. |
@weswigham this was actually originally intended to address issues with |
@weswigham can you take one more look, since I added in the fix for |
# Conflicts: # src/compiler/transformers/module/module.ts
@typescript-bot pack this |
@typescript-bot pack this |
This fixes bugs in both check and emit for
import * as ns ...
andexport * as ns ...
andimport { default as ... }
,export { default } ...
andexport { default as ... }
whenesModuleInterop
istrue
:tslib
forexport * as ns
under--importHelpers --esModuleInterop --target commonjs
.__exportStar
helper forexport * as ns
, which actually uses the__importStar
helper under--esModuleInterop
(and no helper at all when not in that mode).__importStar
helper forimport * as ns
when under--esModuleInterop
.__importDefault
helper forimport { default as ...
,export { default as ...
orexport { default } ...
when under--esModuleInterop
.__importStar
forexport * as ns
under--esModuleInterop --target amd
, though we do forimport * as ns from ...; export { ns };
and for bothexport * as ns
andimport * as ns
incommonjs
.__importStar
forexport { default as ...
orexport { default } ...
under--esModuleInterop
.Fixes #37113
Fixes #35800