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

Fix TS export elision for destructured variables #564

Merged
merged 1 commit into from
Dec 2, 2020

Conversation

alangpierce
Copy link
Owner

Fixes #563
Fixes #473

The type-only export elision implemented in #433 had a false positive for
destructure delcarations, since getDeclarationInfo only looks at top-level
declarations and top-level expressions like const {x} = ... weren't being
marked correctly. To fix, we can mark object shorthand declarations as top-level
when applicable. I also refactored both relevant code paths to avoid the
repeated assignment left-hand side.

Fixes #563
Fixes #473

The type-only export elision implemented in #433 had a false positive for
destructure delcarations, since `getDeclarationInfo` only looks at top-level
declarations and top-level expressions like `const {x} = ...` weren't being
marked correctly. To fix, we can mark object shorthand declarations as top-level
when applicable. I also refactored both relevant code paths to avoid the
repeated assignment left-hand side.
@alangpierce alangpierce merged commit 80f84a6 into master Dec 2, 2020
@alangpierce alangpierce deleted the fix-export-destructured-variable branch December 2, 2020 09:21
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Named export from destructuring doesn't work Exporting a const spread results in undefined
1 participant