-
Notifications
You must be signed in to change notification settings - Fork 12.8k
Ban import=require and export= under erasableSyntaxOnly #61175
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
Ban import=require and export= under erasableSyntaxOnly #61175
Conversation
return MyClassOk; | ||
}()); | ||
//// [commonjs.cjs] | ||
"use strict"; |
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.
Oh no, this means that CJS isn't even erasable because we assume strict and always insert it
@typescript-bot cherry-pick this to release-5.8 |
Hey, @jakebailey! I've created #61178 for you. |
@jakebailey was this intended to affect exports when using |
No, definitely not. I forgot that default exports and export= are the same node. |
Fix in #61210. |
Merged, so should be fixed in the next nightly. I'm glad at least one person is testing them... |
…e-5.8 (#61178) Co-authored-by: Jake Bailey <[email protected]>
Per discussion; this syntax isn't supported by Node.js/Amaro or
ts-blank-space
, andexport=
is not actually erasable as its transformed syntax ismodule.exports=
.This effectively means you can't write any CJS code under
erasableSyntaxOnly
(without usingconst foo = require("foo")
andmodule.exports = ...
directly, which do not bind in TS). Perhaps we can makeconst foo = require("...")
andmodule.exports = ...
bind like they do in JS for TS files in the future.Updates #59601
Updates #61011