diff --git a/crates/oxc_formatter/src/utils/assignment_like.rs b/crates/oxc_formatter/src/utils/assignment_like.rs index d3275087264c0..baa0ab07a3a42 100644 --- a/crates/oxc_formatter/src/utils/assignment_like.rs +++ b/crates/oxc_formatter/src/utils/assignment_like.rs @@ -1027,7 +1027,7 @@ fn is_complex_type_arguments(type_arguments: &TSTypeParameterInstantiation) -> b if let TSType::TSTypeReference(type_ref) = first_argument && let Some(type_args) = &type_ref.type_arguments { - return is_complex_type_arguments(type_args); + return type_args.params.iter().any(is_complex_ts_type); } false diff --git a/crates/oxc_formatter/tests/fixtures/ts/assignments/complex-type-arguments.ts b/crates/oxc_formatter/tests/fixtures/ts/assignments/complex-type-arguments.ts index d4650dcc833b5..77fe2e8c044b5 100644 --- a/crates/oxc_formatter/tests/fixtures/ts/assignments/complex-type-arguments.ts +++ b/crates/oxc_formatter/tests/fixtures/ts/assignments/complex-type-arguments.ts @@ -18,3 +18,8 @@ export class Test { }> >(); } + +// Non-complex type arguments, as none of the type arguments of Record is a complex type. +const result = configurationService.getValue>( + enalementSetting +); diff --git a/crates/oxc_formatter/tests/fixtures/ts/assignments/complex-type-arguments.ts.snap b/crates/oxc_formatter/tests/fixtures/ts/assignments/complex-type-arguments.ts.snap index 5207583918ff9..2b7e90aa2e3dc 100644 --- a/crates/oxc_formatter/tests/fixtures/ts/assignments/complex-type-arguments.ts.snap +++ b/crates/oxc_formatter/tests/fixtures/ts/assignments/complex-type-arguments.ts.snap @@ -23,6 +23,11 @@ export class Test { >(); } +// Non-complex type arguments, as none of the type arguments of Record is a complex type. +const result = configurationService.getValue>( + enalementSetting +); + ==================== Output ==================== ------------------ { printWidth: 80 } @@ -48,6 +53,10 @@ export class Test { >(); } +// Non-complex type arguments, as none of the type arguments of Record is a complex type. +const result = + configurationService.getValue>(enalementSetting); + ------------------- { printWidth: 100 } ------------------- @@ -72,4 +81,7 @@ export class Test { >(); } +// Non-complex type arguments, as none of the type arguments of Record is a complex type. +const result = configurationService.getValue>(enalementSetting); + ===================== End =====================