Skip to content

Incorrect parsing for accessor property with newlineΒ #51707

@sosukesuzuki

Description

@sosukesuzuki

Bug Report

πŸ”Ž Search Terms

  • auto accessor parsing
  • auto accessor newline

πŸ•— Version & Regression Information

  • I was unable to test this on prior versions because auto accessor syntax is landed in 4.9__

⏯ Playground Link

Playground link with relevant code

πŸ’» Code

class Foo {
  accessor
  foo
}

πŸ™ Actual behavior

TypeScript compiler parses the input code to:

// pseudo AST
{
  type: class
  children: [
    accessor property ( name = "foo" )
  ]
}

πŸ™‚ Expected behavior

TypeScript compiler parses the input code to:

// pseudo AST
{
  type: class
  children: [
    property ( name = "accessor" ),
    property ( name = "foo" )
  ]
}

I've reported to babel/babel (babel/babel#15238), but the bug seemed to be in the TS.

Metadata

Metadata

Assignees

Labels

Fix AvailableA PR has been opened for this issueNeeds InvestigationThis issue needs a team member to investigate its status.

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions