Skip to content

[Bug]: Syntax error is thrown for override modifiers for parameter properties #13427

@sosukesuzuki

Description

@sosukesuzuki

💻

  • Would you like to work on a fix?

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)

Metadata

Metadata

Assignees

No one assigned

    Labels

    area: typescriptoutdatedA closed issue/PR that is archived due to age. Recommended to make a new issuepkg: parser

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions