Skip to content

parser: false-positive TS1477 on parenthesized instantiation expression #23133

Description

@shawnrice

oxc_parser emits TS1477 ("An instantiation expression cannot be followed by a property access") for parenthesized instantiation expressions. This behavior differs from tsc.

  • a<b>.c is a proper TS1477
  • (a<b>).c is a TS1477 for oxc_parser but not tsc 6.0.3

oxc_parser will correctly preserve the parens when the parser runs with preserve_parens: true, but oxfmt runs with preserve_parens: false, which causes oxfmt to report a TS1477 error.

What's expected?

(a<b>).c should parse without a TS1477 error regardless of preserve_parens, matching tsc. The decision should come from whether the LHS was parenthesized in the source not from whether a ParenthesizedExpression node happens to survive into the AST. (The unparenthesized a<b>.c must still be a TS1477.)

OXC Playground reproduction

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    Fields

    Priority

    None yet

    Effort

    None yet

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions