Skip to content
This repository has been archived by the owner on Aug 31, 2023. It is now read-only.

Commit

Permalink
fix(rome_js_formatter): Union in mapped type (#4100)
Browse files Browse the repository at this point in the history
  • Loading branch information
MichaReiser authored Dec 23, 2022
1 parent 846ac95 commit 84812f0
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 9 deletions.
1 change: 1 addition & 0 deletions crates/rome_js_formatter/src/ts/types/union_type.rs
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ impl FormatNodeRule<TsUnionType> for FormatTsUnionType {
| JsSyntaxKind::TS_TUPLE_TYPE_ELEMENT_LIST
| JsSyntaxKind::TS_TYPE_ASSERTION_ASSIGNMENT
| JsSyntaxKind::TS_TYPE_ARGUMENT_LIST
| JsSyntaxKind::TS_MAPPED_TYPE
)
)
}
Expand Down
4 changes: 2 additions & 2 deletions crates/rome_js_formatter/tests/specs/ts/type/union_type.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ type Comments =
trailing type */

type A = [
/*leading comment with new line*/
/*leading comment with new line*/
A | B,
];

Expand Down Expand Up @@ -243,4 +243,4 @@ type GetChatsSagaEffects =
type SuperLongTypeNameLoremIpsumLoremIpsumBlaBlaBlaBlaBlaBlaBlaBlaBlaBlaBlaBla =
| Fooo1000
| Baz2000
| BarLoooooooooooooooooooooooooooooooooooooooooooooooooLong;
| BarLoooooooooooooooooooooooooooooooooooooooooooooooooLong;
14 changes: 7 additions & 7 deletions crates/rome_js_formatter/tests/specs/ts/type/union_type.ts.snap
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
---
source: crates/rome_formatter_test/src/snapshot_builder.rs
info:
test_file: ts/type/union_type.ts
info: "ts\\type\\union_type.ts"
---

# Input
Expand All @@ -21,7 +20,7 @@ type Comments =
trailing type */

type A = [
/*leading comment with new line*/
/*leading comment with new line*/
A | B,
];

Expand Down Expand Up @@ -253,6 +252,7 @@ type SuperLongTypeNameLoremIpsumLoremIpsumBlaBlaBlaBlaBlaBlaBlaBlaBlaBlaBlaBla =
| Fooo1000
| Baz2000
| BarLoooooooooooooooooooooooooooooooooooooooooooooooooLong;

```


Expand Down Expand Up @@ -377,10 +377,10 @@ const fooo: SomeThingWithShortMappedType<{

const fooo: SomeThingWithLongMappedType<{
[P in
| AAAAAAAAAAAAAAAAA
| BBBBBBBBBBBB
| CCCCCCCCCCCCCCCCCCCCC
| DDDDDDDDDDDDDDDDDDDDDDDDDDDDD]: number;
| AAAAAAAAAAAAAAAAA
| BBBBBBBBBBBB
| CCCCCCCCCCCCCCCCCCCCC
| DDDDDDDDDDDDDDDDDDDDDDDDDDDDD]: number;
}> = {};

export type A =
Expand Down

0 comments on commit 84812f0

Please sign in to comment.