Skip to content

Typescript does not accept "string name" aliases #56375

Closed
@landonxjames

Description

@landonxjames

🔎 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).

Metadata

Metadata

Assignees

No one assigned

    Labels

    DuplicateAn existing issue was already createdFix AvailableA PR has been opened for this issue

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions