💻
How are you using Babel?
Programmatic API (babel.transform, babel.parse)
Input code
class D extends B {
constructor(protected override readonly foo: string) {
super(foo);
}
}
Configuration file name
No response
Configuration
const { parse } = require("@babel/parser");
parse(`class D extends B {
constructor(protected override readonly foo: string) {
super(foo);
}
}`, { plugins: ["typescript"] });
Current and expected behavior
Current:
Syntax error Unexpected token, expected "," (2:35) is thrown.(Babel try it out link)
Expected:
Success to parse
Environment
Use latest babel/parser directly.
Possible solution
No response
Additional context
from: prettier/prettier#11017
TS Playground Link
TypeScript Compiler allows this syntax explicitly (ref: microsoft/TypeScript#43831)
💻
How are you using Babel?
Programmatic API (
babel.transform,babel.parse)Input code
Configuration file name
No response
Configuration
Current and expected behavior
Current:
Syntax error
Unexpected token, expected "," (2:35)is thrown.(Babel try it out link)Expected:
Success to parse
Environment
Use latest
babel/parserdirectly.Possible solution
No response
Additional context
from: prettier/prettier#11017
TS Playground Link
TypeScript Compiler allows this syntax explicitly (ref: microsoft/TypeScript#43831)