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" };
Bug Report
π Search Terms
import specifier, property name, ModuleExportName, named import
π Version & Regression Information
β― Playground Link
Playground link with relevant code
π» Code
π Actual behavior
Parser error
π Expected behavior
This should be parsed as valid code and properly type-checked. According to ES spec,
ImportSpecifiercan beModuleExportName as ImportedBinding, whereModuleExportNameincludesStringLiteral.Babel parses this correctly.
Accordingly, this should be also allowed: