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
convert @babel/helper-module-transforms to typescript #12928
convert @babel/helper-module-transforms to typescript #12928
Conversation
This pull request is automatically built and testable in CodeSandbox. To see build info of the built libraries, click here or the icon next to each commit SHA. Latest deployment of this branch, based on commit 22f8ab4:
|
Build successful! You can test your changes in the REPL here: https://babeljs.io/repl/build/44809/ |
7b668b4
to
a34bb9d
Compare
a34bb9d
to
bdb2c24
Compare
@@ -280,7 +284,9 @@ function getModuleMetadata( | |||
data.reexports.set(exportName, importName); | |||
|
|||
if (exportName === "__esModule") { | |||
throw exportName.buildCodeFrameError('Illegal export "__esModule".'); | |||
throw spec | |||
.get("exported") |
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.
Good catch from type checking!
@@ -68,7 +93,7 @@ export default function rewriteLiveReferences( | |||
return identNode; | |||
} | |||
|
|||
let namespace = t.identifier(meta.name); | |||
let namespace: t.Expression = t.identifier(meta.name); |
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.
Q: why we need to annotation namespace
is an expression here?
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.
if not adding annotation type is inferred as t.Idendifier
, but it might be is reassigned later to t.CallExpression
which will cause an error
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.
LGTM with some comments.
bdb2c24
to
fd4ce34
Compare
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.
Thanks!
@babel/helper-module-transforms part of #11578