Skip to content

Commit 54a9e98

Browse files
authored
fix: do not blank line after function type's parameters sometimes (#383)
1 parent 0667d86 commit 54a9e98

File tree

2 files changed

+23
-1
lines changed

2 files changed

+23
-1
lines changed

src/generation/generate.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6847,7 +6847,7 @@ fn gen_close_paren_with_type<'a>(opts: GenCloseParenWithTypeOptions<'a>, context
68476847
items.push_condition(if_true(
68486848
"newLineIfHeaderHangingAndTypeNodeMultipleLines",
68496849
Rc::new(move |context| {
6850-
if !has_type_node {
6850+
if !has_type_node || context.writer_info.is_start_of_line() {
68516851
return Some(false);
68526852
}
68536853

tests/specs/issues/issue0382.txt

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
~~ deno: true ~~
2+
== should not add trailing blank line after parameters in function type ==
3+
// this is weird code, but it's set to maintain type argument newlines
4+
type TestingTestTesttttttt<T extends TestingTestingtestingTestingggg> =
5+
T extends Testing ? (
6+
...args: Test<T["parameters"]>
7+
) => Other<
8+
Test,
9+
Test
10+
>
11+
: never;
12+
13+
[expect]
14+
// this is weird code, but it's set to maintain type argument newlines
15+
type TestingTestTesttttttt<T extends TestingTestingtestingTestingggg> =
16+
T extends Testing ? (
17+
...args: Test<T["parameters"]>
18+
) => Other<
19+
Test,
20+
Test
21+
>
22+
: never;

0 commit comments

Comments
 (0)