From b7f6f4424a42c4dd0d3a795c20f14dc75263f827 Mon Sep 17 00:00:00 2001 From: Micha Reiser Date: Fri, 23 Dec 2022 11:51:33 +0100 Subject: [PATCH] fix(rome_js_formatter): Union in mapped type ## Summary Fixes #4074 --- crates/rome_js_formatter/src/ts/types/union_type.rs | 1 + .../tests/specs/ts/type/union_type.ts.snap | 10 +++++----- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/crates/rome_js_formatter/src/ts/types/union_type.rs b/crates/rome_js_formatter/src/ts/types/union_type.rs index 9a8d24413f6e..7c2ea9c71660 100644 --- a/crates/rome_js_formatter/src/ts/types/union_type.rs +++ b/crates/rome_js_formatter/src/ts/types/union_type.rs @@ -53,6 +53,7 @@ impl FormatNodeRule for FormatTsUnionType { | JsSyntaxKind::TS_TUPLE_TYPE_ELEMENT_LIST | JsSyntaxKind::TS_TYPE_ASSERTION_ASSIGNMENT | JsSyntaxKind::TS_TYPE_ARGUMENT_LIST + | JsSyntaxKind::TS_MAPPED_TYPE ) ) } diff --git a/crates/rome_js_formatter/tests/specs/ts/type/union_type.ts.snap b/crates/rome_js_formatter/tests/specs/ts/type/union_type.ts.snap index f16699b20f3b..20ac9d39a6af 100644 --- a/crates/rome_js_formatter/tests/specs/ts/type/union_type.ts.snap +++ b/crates/rome_js_formatter/tests/specs/ts/type/union_type.ts.snap @@ -21,7 +21,7 @@ type Comments = trailing type */ type A = [ - /*leading comment with new line*/ + /*leading comment with new line*/ A | B, ]; @@ -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 =