Skip to content

ImportSpecifier.propertyName should allow string literalsΒ #49147

Description

Bug Report

πŸ”Ž Search Terms

import specifier, property name, ModuleExportName, named import

πŸ•— Version & Regression Information

  • This is the behavior in every version I tried

⏯ Playground Link

Playground link with relevant code

πŸ’» Code

import { "useState" as useEffect } from "react";

πŸ™ Actual behavior

Parser error

πŸ™‚ Expected behavior

This should be parsed as valid code and properly type-checked. According to ES spec, ImportSpecifier can be ModuleExportName as ImportedBinding, where ModuleExportName includes StringLiteral.

Babel parses this correctly.

Accordingly, this should be also allowed:

const a = 1;
export { a as "a-b" };

Activity

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

    BugA bug in TypeScriptFix AvailableA PR has been opened for this issueHelp WantedYou can do this

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions