Skip to content

Typescript does not accept "string name" aliases #56375

Closed

Description

🔎 Search Terms

export alias string names
import alias string names
string alias for imports/exports

🕗 Version & Regression Information

  • This is the behavior in every version I tried, and I reviewed the FAQ for entries about string names as import/export aliases

⏯ Playground Link

https://www.typescriptlang.org/play?module=1&ssl=3&ssc=17&pln=3&pc=20#code/MYewdgzgLgBAZiEMC8MCMBuAUFgpgDwAcQAnWAbwSQEMIYAiAI2pPoF9sg

💻 Code

const foo = 1;

export {foo as "bar"};

🙁 Actual behavior

This fails to compile because of the as "bar" in the export statement.

🙂 Expected behavior

This should compile and allow string name aliases.

Additional information about the issue

String name import/export aliases should be allowed by the ts compiler. They are valid javascript (see the syntax section of the MDN page in exports).

Activity

  1. fatcerberus commented on Nov 13, 2023

    @fatcerberus

    Duplicate of #40594

  2. fatcerberus commented on Nov 13, 2023

    @fatcerberus

    PR to implement support for this is here #49297 but seems to be stalled.

  3. added
    Duplicate
    on Nov 13, 2023
  4. landonxjames commented on Nov 13, 2023

    @landonxjames
    Author

    Ahh thank you for the pointer! Closing in favor of the existing issue.

  5. added
    Fix Available
    on May 30, 2024
  6. locked as resolved and limited conversation to collaborators on Oct 22, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    DuplicateFix Available

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions