-
Notifications
You must be signed in to change notification settings - Fork 13.3k
Allow keywords in property names on the right of import ... =Β #48274
Copy link
Copy link
Closed
Description
Bug Report
π Search Terms
import equals declaration module reference keyword
π Version & Regression Information
- This is the behavior in every version I tried, and I reviewed the FAQ for entries about import
β― Playground Link
Playground link with relevant code
π» Code
Just for the syntax:
import X2 = Y.if;A complete example:
// dep.ts
module A {}
export { A as if };// main.ts
import * as T from "./dep"
import mod = T.if;π Actual behavior
This code throws that if is a reserved word, and produces a broken AST.
π Expected behavior
That code should be allowed: if Y is a module namespace object that exports an if module, it's runtime behavior is well defined. If you rename if to anything else, it works.
Note that I didn't find this surprising ("surprising" because every other member expression in the language allows reserve words after .) restriction in real code, but while reading Babel's TypeScript parsing code.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels