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

Add support for TS type-only imports and exports #532

Merged
merged 1 commit into from
May 11, 2020

Commits on May 11, 2020

  1. Add support for TS type-only imports and exports

    Fixes #520
    
    The PR #523 already added parsing support for type-only import and export
    syntax, and there was already support for removing `import type` from Flow, so
    the only new logic was to fully support `export type`. The implementation here
    is a little ugly; Flow's version sets the tokens as type tokens, whereas the TS
    version sets the types as regular tokens and removes them at transform type.
    This seems to be necessary to follow the behavior that `export type` statements
    do not result in the imported value being elided.
    
    Ideally, Sucrase would support the `importsNotUsedAsValues` TS preference in
    some way, but for now, it keeps the old behavior of eliding type-only imports.
    The setting `importsNotUsedAsValues=error` should make the distinction
    irrelevant anyway, so it seems low priority to support.
    alangpierce committed May 11, 2020
    Configuration menu
    Copy the full SHA
    8d322de View commit details
    Browse the repository at this point in the history