-
Notifications
You must be signed in to change notification settings - Fork 12.5k
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
TS defines __esModule of exports even if all imports are 'import type' #42371
Labels
Duplicate
An existing issue was already created
Comments
I'm pretty sure this is the same as #41513. By having an import statement you're making your file a module, and as a result you have a related exports statement in your compiled file. This behavior was introduced with 4.0, and the old behavior in TypeScript 3.9 is considered a bug. |
This issue has been marked as a 'Duplicate' and has seen no recent activity. It has been automatically closed for house-keeping purposes. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Bug (or bad specification) Report
If some doesn't have 'import', the tsc doesn't generate
Object.defineProperty(exports, "__esModule", { value: true });
.import type
looks standing for not generating import or code for module system in js but currentlyObject.defineProperty(exports, "__esModule", { value: true });
is generated.🔎 Search Terms
In issues and on Google searched with '__esModule import type' and '__esModule generated even if import type'
🕗 Version & Regression Information
typescript: 4.1.3
⏯ Playground Link
Please ignore the compile error. I don't know what module can I use on the playground.
Playground link with relevant code
💻 Code
🙁 Actual behavior
exports code below:
🙂 Expected behavior
exports code below:
This can be a problem if I want to write ts without tools like WebPack.
The text was updated successfully, but these errors were encountered: