-
Notifications
You must be signed in to change notification settings - Fork 143
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Incorrect elision of import {}
with TS transform disabled
#801
Comments
Another case to consider is the Flow behavior for this code. Babel and |
Fixes #801 Sucrase previously had a somewhat unified approach to import/export elision, but this caused an issue with `import {}` statements, which should be removed in TypeScript, but not in Flow or with neither transform enabled. Now, we plumb the full configuration to both transforms and use the configuration to decide which strategy is relevant.
Fixes #801 Sucrase previously had a somewhat unified approach to import/export elision, but this caused an issue with `import {}` statements, which should be removed in TypeScript, but not in Flow or with neither transform enabled. Now, we plumb the full configuration to both transforms and use the configuration to decide which strategy is relevant.
As I was working on import elision behavior, I noticed a bug when handling this code snippet:
The expected behavior is:
./a
is never evaluated at runtime. TS playground link. This happens because "all imports are type-only" is vacuously true../a
is evaluated at runtime. This is because import elision is a TS feature, so in plain JS there's no reason to do it.Sucrase handles the first case correctly, but when the TS transform is disabled, it incorrectly removes the import, so this issue tracks the fix for that.
The text was updated successfully, but these errors were encountered: