Prettier 3.4.0 (Also tested on 3.4.1)
Playground link
--parser typescript
--print-width 120
--single-quote
--trailing-comma es5
Input:
const myDecorator = (target, propertyKey, descriptor) => {
console.log(descriptor.value);
}
class myClass {
@myDecorator
/**
* The method description
*
*/
async myMethod(foo: Foo, bar: Bar) {
console.log(foo);
}
}
Output:
const myDecorator = (target, propertyKey, descriptor) => {
console.log(descriptor.value);
};
class myClass {
@myDecorator
async /**
* The method description
*
*/
myMethod(foo: Foo, bar: Bar) {
console.log(foo);
}
}
Expected output:
Why?
The async keyword gets hoisted above the jsdoc. Even worse, next prettier run adds a ; after it, breaking the syntax :D
Prettier 3.4.0 (Also tested on 3.4.1)
Playground link
Input:
Output:
Expected output:
Why?
The
asynckeyword gets hoisted above the jsdoc. Even worse, next prettier run adds a;after it, breaking the syntax :D