Skip to content

Decorators on accessor private fields report SyntaxError #14547

@weareoutman

Description

@weareoutman

Prettier 2.8.5
Playground link

--parser typescript

Input:

class A {
  @dec() accessor #field;
}

Output:

SyntaxError: Decorators are not valid here. (2:3)
  1 | class A {
> 2 |   @dec() accessor #field;
    |   ^^^^^^
  3 | }

Expected behavior:

No SyntaxError. Change the parser from "typescript" to "babel-ts" will make it work.

Prettier 2.8.4 works fine, seems 2.8.5 introduced this.

Metadata

Metadata

Assignees

Labels

lang:typescriptIssues affecting TypeScript-specific constructs (not general JS issues)locked-due-to-inactivityPlease open a new issue and fill out the template instead of commenting.

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions