Closed
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
.
Accordingly, this should be also allowed:
const a = 1;
export { a as "a-b" };