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: