-
-
Notifications
You must be signed in to change notification settings - Fork 5.8k
Closed
Labels
Spec: Import Attributesarea: typescriptoutdatedA closed issue/PR that is archived due to age. Recommended to make a new issueA closed issue/PR that is archived due to age. Recommended to make a new issuepkg: parser
Description
💻
- Would you like to work on a fix?
How are you using Babel?
Programmatic API (babel.transform, babel.parse)
Input code
type A = import("foo", {with: {type: "json"}})Configuration file name
No response
Configuration
N/A
Current and expected behavior
Current:
SyntaxError: Unexpected token, expected ")"
Expected:
Success
Environment
const { parse } = require("@babel/parser"); // 7.23.9
const code = `type A = import("foo", { with: { type: "json"} }});`;
const result = parse(code, { plugins: ["typescript", "importAttributes" ]});Possible solution
Fix the parser
Additional context
context: prettier/prettier#16072
TypeScript compiler can parse it(Playground link)
Metadata
Metadata
Assignees
Labels
Spec: Import Attributesarea: typescriptoutdatedA closed issue/PR that is archived due to age. Recommended to make a new issueA closed issue/PR that is archived due to age. Recommended to make a new issuepkg: parser