Prettier 2.8.3
Playground link
Input:
class Person {
@(myDecoratorArray[0])
greet() {}
}
Output:
class Person {
@myDecoratorArray[0]
greet() {}
}
Why is this wrong?
In the original script, the Person class has a single member: a greet method decorated with myDecoratorArray[0].
The output has very different code. The Person class now has two members:
- a
greet method with zero decorators, and
- a computed property (
0) decorated with myDecoratorArray.
Expected behavior:
The output should be the same as the input, with the decorator properly enclosed in parentheses.
Prettier 2.8.3
Playground link
Input:
Output:
Why is this wrong?
In the original script, the
Personclass has a single member: agreetmethod decorated withmyDecoratorArray[0].The output has very different code. The
Personclass now has two members:greetmethod with zero decorators, and0) decorated withmyDecoratorArray.Expected behavior:
The output should be the same as the input, with the decorator properly enclosed in parentheses.