Skip to content
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

Fix error message for type-only import of ES module from CJS #59711

Conversation

andrewbranch
Copy link
Member

@andrewbranch andrewbranch commented Aug 21, 2024

Improves an error message and adds a codefix for type-only imports (and type imports) in CJS files that reference ESM files. The current error says that you can't do it because it will produce a require call, which isn't true for type-only imports. The real reasons are too nuanced to explain in an error message, so the new message just says what you have to do to work around it.

Related:

@typescript-bot typescript-bot added Author: Team For Uncommitted Bug PR for untriaged, rejected, closed or missing bug labels Aug 21, 2024
@andrewbranch andrewbranch merged commit a86b5e2 into microsoft:main Aug 23, 2024
32 checks passed
@andrewbranch andrewbranch deleted the bug/type-only-esm-cjs-compat-error-message branch August 23, 2024 19:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Author: Team For Uncommitted Bug PR for untriaged, rejected, closed or missing bug
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

4 participants