-
-
Notifications
You must be signed in to change notification settings - Fork 4.6k
Labels
lang:typescriptIssues affecting TypeScript-specific constructs (not general JS issues)Issues affecting TypeScript-specific constructs (not general JS issues)
Description
Prettier 2.4.1
Playground link
--parser typescriptInput:
@test().x('global').y()
class X {}Output:
@(test().x("global").y())
class X {}Expected behavior:
@test().x('global').y()
class X {}In TypeScript, the two decorator usages (Input and Output above) are same. They will be compiled to JS like:
let X = class X {
};
X = __decorate([
// from the input
test().x('global').y()
// and from the output. they are same
(test().x('global').y())
], X);But the Input's style (no parentheses) is easier to read and looks better. I found a related PR #5785 caused the issue.
Maybe Prettier should support parser based format behavior or parser based config? Only babel should add parentheses for decorators but typescript not.
Metadata
Metadata
Assignees
Labels
lang:typescriptIssues affecting TypeScript-specific constructs (not general JS issues)Issues affecting TypeScript-specific constructs (not general JS issues)