diff --git a/crates/oxc_formatter/src/formatter/comments.rs b/crates/oxc_formatter/src/formatter/comments.rs index e42abba8f367d..390e2dd824389 100644 --- a/crates/oxc_formatter/src/formatter/comments.rs +++ b/crates/oxc_formatter/src/formatter/comments.rs @@ -128,17 +128,29 @@ pub struct Comments<'a> { /// The index of the type cast comment that has been printed already. /// Used to prevent duplicate processing of special TypeScript type cast comments. handled_type_cast_comment: usize, + /// Optional limit for the unprinted_comments view. + /// + /// When set, [`Self::unprinted_comments()`] will only return comments up to this index, + /// effectively hiding comments beyond this point from the formatter. + pub view_limit: Option, } impl<'a> Comments<'a> { pub fn new(source_text: SourceText<'a>, comments: &'a [Comment]) -> Self { - Comments { source_text, comments, printed_count: 0, handled_type_cast_comment: 0 } + Comments { + source_text, + comments, + printed_count: 0, + handled_type_cast_comment: 0, + view_limit: None, + } } /// Returns comments that have not been printed yet. #[inline] pub fn unprinted_comments(&self) -> &'a [Comment] { - &self.comments[self.printed_count..] + let end = self.view_limit.unwrap_or(self.comments.len()); + &self.comments[self.printed_count..end] } /// Returns comments that have already been printed. @@ -486,6 +498,34 @@ impl<'a> Comments<'a> { pub fn is_already_handled_type_cast_comment(&self) -> bool { self.printed_count == self.handled_type_cast_comment } + + /// Temporarily limits the unprinted comments view to only those before the given position. + /// Returns the previous view limit to allow restoration. + pub fn limit_comments_up_to(&mut self, end_pos: u32) -> Option { + // Save the original limit for restoration + let original_limit = self.view_limit; + + // Find the index of the first comment that starts at or after end_pos + // Using binary search would be more efficient for large comment arrays + let limit_index = self.comments[self.printed_count..] + .iter() + .position(|c| c.span.start >= end_pos) + .map_or(self.comments.len(), |idx| self.printed_count + idx); + + // Only update if we're actually limiting the view + if limit_index < self.comments.len() { + self.view_limit = Some(limit_index); + } + + original_limit + } + + /// Restores the view limit to a previously saved value. + /// This is typically used after temporarily limiting the view with `limit_comments_up_to`. + #[inline] + pub fn restore_view_limit(&mut self, limit: Option) { + self.view_limit = limit; + } } /// Checks if a pattern matches at the given position. diff --git a/crates/oxc_formatter/src/utils/conditional.rs b/crates/oxc_formatter/src/utils/conditional.rs index 92f407e4cf2c6..898ee6b092327 100644 --- a/crates/oxc_formatter/src/utils/conditional.rs +++ b/crates/oxc_formatter/src/utils/conditional.rs @@ -7,7 +7,7 @@ use crate::{ Format, FormatResult, FormatWrite, formatter::{Formatter, prelude::*, trivia::FormatTrailingComments}, generated::ast_nodes::{AstNode, AstNodes}, - utils::expression::FormatExpressionWithoutTrailingComments, + utils::format_node_without_trailing_comments::FormatNodeWithoutTrailingComments, write, }; @@ -171,32 +171,35 @@ impl<'a> FormatConditionalLike<'a, '_> { fn layout(&self, f: &mut Formatter<'_, 'a>) -> ConditionalLayout { let self_span = self.span(); - let (is_test, is_consequent) = match self.parent() { + match self.parent() { AstNodes::ConditionalExpression(parent) => { let parent_expr = parent.as_ref(); - (parent_expr.test.span() == self_span, parent_expr.consequent.span() == self_span) + if parent_expr.test.span() == self_span { + ConditionalLayout::NestedTest + } else if parent_expr.consequent.span() == self_span { + ConditionalLayout::NestedConsequent + } else { + ConditionalLayout::NestedAlternate + } } AstNodes::TSConditionalType(parent) => { let parent_type = parent.as_ref(); // For TS conditional types, both check_type and extends_type are part of the test let is_test = parent_type.check_type.span() == self_span || parent_type.extends_type.span() == self_span; - let is_consequent = parent_type.true_type.span() == self_span; - (is_test, is_consequent) + if is_test { + ConditionalLayout::NestedTest + } else if parent_type.true_type.span() == self_span { + ConditionalLayout::NestedConsequent + } else { + ConditionalLayout::NestedAlternate + } } _ => { let jsx_chain = f.context().source_type().is_jsx() && self.is_jsx_conditional_chain(); - return ConditionalLayout::Root { jsx_chain }; + ConditionalLayout::Root { jsx_chain } } - }; - - if is_test { - ConditionalLayout::NestedTest - } else if is_consequent { - ConditionalLayout::NestedConsequent - } else { - ConditionalLayout::NestedAlternate } } @@ -374,7 +377,7 @@ impl<'a> FormatConditionalLike<'a, '_> { ) -> FormatResult<()> { let format_inner = format_with(|f| match self.conditional { ConditionalLike::ConditionalExpression(conditional) => { - write!(f, FormatExpressionWithoutTrailingComments(conditional.test()))?; + write!(f, FormatNodeWithoutTrailingComments(conditional.test()))?; format_trailing_comments( conditional.test.span().end, conditional.consequent.span().start, @@ -390,8 +393,15 @@ impl<'a> FormatConditionalLike<'a, '_> { space(), "extends", space(), - conditional.extends_type() + FormatNodeWithoutTrailingComments(conditional.extends_type()) ] + )?; + + format_trailing_comments( + conditional.extends_type.span().end, + conditional.true_type.span().start, + b'?', + f, ) } }); @@ -411,53 +421,60 @@ impl<'a> FormatConditionalLike<'a, '_> { ) -> FormatResult<()> { write!(f, [soft_line_break_or_space(), "?", space()])?; - let format_consequent = format_with(|f| match self.conditional { - ConditionalLike::ConditionalExpression(conditional) => { - let is_consequent_nested = match self.conditional { + let format_consequent = format_with(|f| { + let format_consequent_with_trailing_comments = + format_once(|f| match self.conditional { ConditionalLike::ConditionalExpression(conditional) => { - matches!(conditional.consequent, Expression::ConditionalExpression(_)) + write!(f, FormatNodeWithoutTrailingComments(conditional.consequent()))?; + format_trailing_comments( + conditional.consequent.span().end, + conditional.alternate.span().start, + b':', + f, + ) } ConditionalLike::TSConditionalType(conditional) => { - matches!(conditional.true_type, TSType::TSConditionalType(_)) - } - }; - - let format_consequent = format_once(|f| { - write!(f, FormatExpressionWithoutTrailingComments(conditional.consequent()))?; - format_trailing_comments( - conditional.consequent.span().end, - conditional.alternate.span().start, - b':', - f, - ) - }); - - let format_consequent = format_with(|f| { - if f.options().indent_style.is_space() { - write!(f, [align(2, &format_consequent)]) - } else { - write!(f, [indent(&format_consequent)]) + write!(f, FormatNodeWithoutTrailingComments(conditional.true_type()))?; + format_trailing_comments( + conditional.true_type.span().end, + conditional.false_type.span().start, + b':', + f, + ) } }); - if is_consequent_nested { - // Add parentheses around the consequent if it is a conditional expression and fits on the same line - // so that it's easier to identify the parts that belong to a conditional expression. - // `a ? b ? c: d : e` -> `a ? (b ? c: d) : e` - write!( - f, - [ - if_group_fits_on_line(&text("(")), - format_consequent, - if_group_fits_on_line(&text(")")) - ] - ) + let format_consequent_with_proper_indentation = format_with(|f| { + if f.options().indent_style.is_space() { + write!(f, [align(2, &format_consequent_with_trailing_comments)]) } else { - write!(f, format_consequent) + write!(f, [indent(&format_consequent_with_trailing_comments)]) } - } - ConditionalLike::TSConditionalType(conditional) => { - write!(f, [conditional.true_type()]) + }); + + let is_nested_consequent = match self.conditional { + ConditionalLike::ConditionalExpression(conditional) => { + matches!(conditional.consequent, Expression::ConditionalExpression(_)) + } + ConditionalLike::TSConditionalType(conditional) => { + matches!(conditional.true_type, TSType::TSConditionalType(_)) + } + }; + + if is_nested_consequent { + // Add parentheses around the consequent if it is a conditional expression and fits on the same line + // so that it's easier to identify the parts that belong to a conditional expression. + // `a ? b ? c: d : e` -> `a ? (b ? c: d) : e` + write!( + f, + [ + if_group_fits_on_line(&text("(")), + format_consequent_with_proper_indentation, + if_group_fits_on_line(&text(")")) + ] + ) + } else { + write!(f, format_consequent_with_proper_indentation) } }); @@ -662,7 +679,7 @@ impl<'a> Format<'a> for FormatJsxChainExpression<'a, '_> { } .fmt(f) } else { - FormatExpressionWithoutTrailingComments(self.expression).fmt(f) + FormatNodeWithoutTrailingComments(self.expression).fmt(f) } }); diff --git a/crates/oxc_formatter/src/utils/expression.rs b/crates/oxc_formatter/src/utils/expression.rs deleted file mode 100644 index adb2e81ff24a3..0000000000000 --- a/crates/oxc_formatter/src/utils/expression.rs +++ /dev/null @@ -1,255 +0,0 @@ -use oxc_ast::ast::Expression; -use oxc_span::GetSpan; - -use crate::{ - Format, - formatter::{FormatResult, Formatter, prelude::*}, - generated::ast_nodes::{AstNode, AstNodes}, - parentheses::NeedsParentheses, - utils::typecast::format_type_cast_comment_node, - write, - write::FormatWrite, -}; - -pub struct FormatExpressionWithoutTrailingComments<'a, 'b>(pub &'b AstNode<'a, Expression<'a>>); - -impl<'a> Format<'a> for FormatExpressionWithoutTrailingComments<'a, '_> { - fn fmt(&self, f: &mut Formatter<'_, 'a>) -> FormatResult<()> { - let is_object_or_array_expression = matches!( - self.0.as_ast_nodes(), - AstNodes::ObjectExpression(_) | AstNodes::ArrayExpression(_) - ); - if format_type_cast_comment_node(self.0, is_object_or_array_expression, f)? { - return Ok(()); - } - - let needs_parentheses = self.0.needs_parentheses(f); - let print_left_paren = - |f: &mut Formatter<'_, 'a>| write!(f, needs_parentheses.then_some("(")); - - match self.0.as_ast_nodes() { - AstNodes::BooleanLiteral(n) => { - n.format_leading_comments(f)?; - print_left_paren(f)?; - n.write(f) - } - AstNodes::NullLiteral(n) => { - n.format_leading_comments(f)?; - print_left_paren(f)?; - n.write(f) - } - AstNodes::NumericLiteral(n) => { - n.format_leading_comments(f)?; - print_left_paren(f)?; - n.write(f) - } - AstNodes::BigIntLiteral(n) => { - n.format_leading_comments(f)?; - print_left_paren(f)?; - n.write(f) - } - AstNodes::RegExpLiteral(n) => { - n.format_leading_comments(f)?; - print_left_paren(f)?; - n.write(f) - } - AstNodes::StringLiteral(n) => { - n.format_leading_comments(f)?; - print_left_paren(f)?; - n.write(f) - } - AstNodes::TemplateLiteral(n) => { - n.format_leading_comments(f)?; - print_left_paren(f)?; - n.write(f) - } - AstNodes::IdentifierReference(n) => { - n.format_leading_comments(f)?; - print_left_paren(f)?; - n.write(f) - } - AstNodes::MetaProperty(n) => { - n.format_leading_comments(f)?; - print_left_paren(f)?; - n.write(f) - } - AstNodes::Super(n) => { - n.format_leading_comments(f)?; - print_left_paren(f)?; - n.write(f) - } - AstNodes::ArrayExpression(n) => { - n.format_leading_comments(f)?; - print_left_paren(f)?; - n.write(f) - } - AstNodes::ArrowFunctionExpression(n) => { - n.format_leading_comments(f)?; - print_left_paren(f)?; - n.write(f) - } - AstNodes::AssignmentExpression(n) => { - n.format_leading_comments(f)?; - print_left_paren(f)?; - n.write(f) - } - AstNodes::AwaitExpression(n) => { - n.format_leading_comments(f)?; - print_left_paren(f)?; - n.write(f) - } - AstNodes::BinaryExpression(n) => { - n.format_leading_comments(f)?; - print_left_paren(f)?; - n.write(f) - } - AstNodes::CallExpression(n) => { - n.format_leading_comments(f)?; - print_left_paren(f)?; - n.write(f) - } - AstNodes::ChainExpression(n) => { - n.format_leading_comments(f)?; - print_left_paren(f)?; - n.write(f) - } - AstNodes::Class(n) => { - n.format_leading_comments(f)?; - print_left_paren(f)?; - n.write(f) - } - AstNodes::ConditionalExpression(n) => { - n.format_leading_comments(f)?; - print_left_paren(f)?; - n.write(f) - } - AstNodes::Function(n) => { - n.format_leading_comments(f)?; - print_left_paren(f)?; - n.write(f) - } - AstNodes::ImportExpression(n) => { - n.format_leading_comments(f)?; - print_left_paren(f)?; - n.write(f) - } - AstNodes::LogicalExpression(n) => { - n.format_leading_comments(f)?; - print_left_paren(f)?; - n.write(f) - } - AstNodes::NewExpression(n) => { - n.format_leading_comments(f)?; - print_left_paren(f)?; - n.write(f) - } - AstNodes::ObjectExpression(n) => { - n.format_leading_comments(f)?; - print_left_paren(f)?; - n.write(f) - } - AstNodes::ParenthesizedExpression(n) => { - n.format_leading_comments(f)?; - print_left_paren(f)?; - n.write(f) - } - AstNodes::SequenceExpression(n) => { - n.format_leading_comments(f)?; - print_left_paren(f)?; - n.write(f) - } - AstNodes::TaggedTemplateExpression(n) => { - n.format_leading_comments(f)?; - print_left_paren(f)?; - n.write(f) - } - AstNodes::ThisExpression(n) => { - n.format_leading_comments(f)?; - print_left_paren(f)?; - n.write(f) - } - AstNodes::UnaryExpression(n) => { - n.format_leading_comments(f)?; - print_left_paren(f)?; - n.write(f) - } - AstNodes::UpdateExpression(n) => { - n.format_leading_comments(f)?; - print_left_paren(f)?; - n.write(f) - } - AstNodes::YieldExpression(n) => { - n.format_leading_comments(f)?; - print_left_paren(f)?; - n.write(f) - } - AstNodes::PrivateInExpression(n) => { - n.format_leading_comments(f)?; - print_left_paren(f)?; - n.write(f) - } - AstNodes::JSXElement(n) => { - n.format_leading_comments(f)?; - print_left_paren(f)?; - n.write(f) - } - AstNodes::JSXFragment(n) => { - n.format_leading_comments(f)?; - print_left_paren(f)?; - n.write(f) - } - AstNodes::TSAsExpression(n) => { - n.format_leading_comments(f)?; - print_left_paren(f)?; - n.write(f) - } - AstNodes::TSSatisfiesExpression(n) => { - n.format_leading_comments(f)?; - print_left_paren(f)?; - n.write(f) - } - AstNodes::TSTypeAssertion(n) => { - n.format_leading_comments(f)?; - print_left_paren(f)?; - n.write(f) - } - AstNodes::TSNonNullExpression(n) => { - n.format_leading_comments(f)?; - print_left_paren(f)?; - n.write(f) - } - AstNodes::TSInstantiationExpression(n) => { - n.format_leading_comments(f)?; - print_left_paren(f)?; - n.write(f) - } - AstNodes::V8IntrinsicExpression(n) => { - n.format_leading_comments(f)?; - print_left_paren(f)?; - n.write(f) - } - AstNodes::StaticMemberExpression(n) => { - n.format_leading_comments(f)?; - print_left_paren(f)?; - n.write(f) - } - AstNodes::ComputedMemberExpression(n) => { - n.format_leading_comments(f)?; - print_left_paren(f)?; - n.write(f) - } - AstNodes::PrivateFieldExpression(n) => { - n.format_leading_comments(f)?; - print_left_paren(f)?; - n.write(f) - } - _ => unreachable!(), - }?; - - if needs_parentheses { - write!(f, [")"])?; - } - - Ok(()) - } -} diff --git a/crates/oxc_formatter/src/utils/format_node_without_trailing_comments.rs b/crates/oxc_formatter/src/utils/format_node_without_trailing_comments.rs new file mode 100644 index 0000000000000..0bf3547e02949 --- /dev/null +++ b/crates/oxc_formatter/src/utils/format_node_without_trailing_comments.rs @@ -0,0 +1,33 @@ +use oxc_span::GetSpan; + +use crate::{Format, FormatResult, formatter::Formatter}; + +/// Generic wrapper for formatting a node without its trailing comments. +/// +/// This wrapper temporarily hides comments that appear after the node's span end position, +/// effectively preventing trailing comments from being formatted while preserving all other +/// comment formatting behavior (leading comments, internal comments). +pub struct FormatNodeWithoutTrailingComments<'b, T>(pub &'b T); + +impl<'a, T> Format<'a> for FormatNodeWithoutTrailingComments<'_, T> +where + T: Format<'a> + GetSpan, +{ + fn fmt(&self, f: &mut Formatter<'_, 'a>) -> FormatResult<()> { + let node_end = self.0.span().end; + + // Save the current comment view limit and temporarily restrict it + // to hide comments that start at or after the node's end position + let previous_limit = f.context_mut().comments_mut().limit_comments_up_to(node_end); + + // Format the node with the restricted comment view + // This allows all comments within the node's span to be formatted normally, + // but hides any trailing comments that come after it + let result = self.0.fmt(f); + + // Restore the previous comment view limit + f.context_mut().comments_mut().restore_view_limit(previous_limit); + + result + } +} diff --git a/crates/oxc_formatter/src/utils/mod.rs b/crates/oxc_formatter/src/utils/mod.rs index 9685e2c3532d3..00f204778265b 100644 --- a/crates/oxc_formatter/src/utils/mod.rs +++ b/crates/oxc_formatter/src/utils/mod.rs @@ -1,7 +1,7 @@ pub mod assignment_like; pub mod call_expression; pub mod conditional; -pub mod expression; +pub mod format_node_without_trailing_comments; pub mod jsx; pub mod member_chain; pub mod object; diff --git a/crates/oxc_formatter/src/write/binary_like_expression.rs b/crates/oxc_formatter/src/write/binary_like_expression.rs index 4d7f8e53fdfb6..da3f8da0ccba1 100644 --- a/crates/oxc_formatter/src/write/binary_like_expression.rs +++ b/crates/oxc_formatter/src/write/binary_like_expression.rs @@ -9,7 +9,7 @@ use crate::{ Format, formatter::{FormatResult, Formatter}, generated::ast_nodes::{AstNode, AstNodes}, - utils::expression::FormatExpressionWithoutTrailingComments, + utils::format_node_without_trailing_comments::FormatNodeWithoutTrailingComments, }; use crate::{format_args, formatter::prelude::*, write}; @@ -322,7 +322,7 @@ impl<'a> Format<'a> for BinaryLeftOrRightSide<'a, '_> { } if *root { - write!(f, FormatExpressionWithoutTrailingComments(right)) + write!(f, FormatNodeWithoutTrailingComments(right)) } else { write!(f, right) } diff --git a/crates/oxc_formatter/src/write/class.rs b/crates/oxc_formatter/src/write/class.rs index 7b792afa8f92c..b3b05dadf4d3d 100644 --- a/crates/oxc_formatter/src/write/class.rs +++ b/crates/oxc_formatter/src/write/class.rs @@ -15,7 +15,8 @@ use crate::{ generated::ast_nodes::{AstNode, AstNodes}, parentheses::NeedsParentheses, utils::{ - assignment_like::AssignmentLike, expression::FormatExpressionWithoutTrailingComments, + assignment_like::AssignmentLike, + format_node_without_trailing_comments::FormatNodeWithoutTrailingComments, object::format_property_key, }, write, @@ -378,7 +379,7 @@ impl<'a> Format<'a> for FormatClass<'a, '_> { type_arguments.fmt(f) } } else if implements.is_empty() { - FormatExpressionWithoutTrailingComments(extends).fmt(f)?; + FormatNodeWithoutTrailingComments(extends).fmt(f)?; // Only add trailing comments if they're not line comments // Line comments are handled separately to ensure proper placement if !has_trailing_comments { diff --git a/crates/oxc_formatter/src/write/jsx/mod.rs b/crates/oxc_formatter/src/write/jsx/mod.rs index dcfabbec69b88..eb80d9fe8136c 100644 --- a/crates/oxc_formatter/src/write/jsx/mod.rs +++ b/crates/oxc_formatter/src/write/jsx/mod.rs @@ -18,7 +18,6 @@ use crate::{ trivia::{DanglingIndentMode, FormatDanglingComments}, }, generated::ast_nodes::{AstNode, AstNodes}, - utils::expression::FormatExpressionWithoutTrailingComments, write, }; diff --git a/crates/oxc_formatter/src/write/mod.rs b/crates/oxc_formatter/src/write/mod.rs index 18020752bcb83..d72afa2df18bc 100644 --- a/crates/oxc_formatter/src/write/mod.rs +++ b/crates/oxc_formatter/src/write/mod.rs @@ -1829,7 +1829,7 @@ impl<'a> FormatWrite<'a> for AstNode<'a, TSConstructorType<'a>> { } write!( f, - [ + [group(&format_args!( "new", space(), type_parameters, @@ -1838,7 +1838,7 @@ impl<'a> FormatWrite<'a> for AstNode<'a, TSConstructorType<'a>> { "=>", space(), return_type.type_annotation() - ] + ))] ); Ok(()) } diff --git a/crates/oxc_formatter/src/write/template.rs b/crates/oxc_formatter/src/write/template.rs index 28e26d0124d4b..f998f23429080 100644 --- a/crates/oxc_formatter/src/write/template.rs +++ b/crates/oxc_formatter/src/write/template.rs @@ -18,7 +18,8 @@ use crate::{ }, generated::ast_nodes::{AstNode, AstNodeIterator}, utils::{ - call_expression::is_test_each_pattern, expression::FormatExpressionWithoutTrailingComments, + call_expression::is_test_each_pattern, + format_node_without_trailing_comments::FormatNodeWithoutTrailingComments, }, write, }; @@ -245,7 +246,7 @@ impl<'a> Format<'a> for FormatTemplateExpression<'a, '_> { TemplateExpression::Expression(e) => { let leading_comments = f.context().comments().comments_before(e.span().start); FormatLeadingComments::Comments(leading_comments).fmt(f)?; - FormatExpressionWithoutTrailingComments(e).fmt(f)?; + FormatNodeWithoutTrailingComments(e).fmt(f)?; let trailing_comments = f.context().comments().comments_before_character(e.span().start, b'}'); has_comment_in_expression = diff --git a/tasks/coverage/snapshots/formatter_typescript.snap b/tasks/coverage/snapshots/formatter_typescript.snap index 5203d6068ce23..3728f83b5e7fd 100644 --- a/tasks/coverage/snapshots/formatter_typescript.snap +++ b/tasks/coverage/snapshots/formatter_typescript.snap @@ -2,13 +2,11 @@ commit: 261630d6 formatter_typescript Summary: AST Parsed : 8816/8816 (100.00%) -Positive Passed: 8792/8816 (99.73%) +Positive Passed: 8794/8816 (99.75%) Mismatch: tasks/coverage/typescript/tests/cases/compiler/amdLikeInputDeclarationEmit.ts Expect to Parse: tasks/coverage/typescript/tests/cases/compiler/arrayFromAsync.ts `await` is only allowed within async functions and at the top levels of modules`await` is only allowed within async functions and at the top levels of modules`await` is only allowed within async functions and at the top levels of modules`await` is only allowed within async functions and at the top levels of modules`await` is only allowed within async functions and at the top levels of modules`await` is only allowed within async functions and at the top levels of modules`await` is only allowed within async functions and at the top levels of modules`await` is only allowed within async functions and at the top levels of modules`await` is only allowed within async functions and at the top levels of modules`await` is only allowed within async functions and at the top levels of modules`await` is only allowed within async functions and at the top levels of modules -Mismatch: tasks/coverage/typescript/tests/cases/compiler/callOfConditionalTypeWithConcreteBranches.ts - Mismatch: tasks/coverage/typescript/tests/cases/compiler/coAndContraVariantInferences3.ts Mismatch: tasks/coverage/typescript/tests/cases/compiler/complexNarrowingWithAny.ts @@ -29,8 +27,6 @@ Mismatch: tasks/coverage/typescript/tests/cases/compiler/sourceMapValidationClas Mismatch: tasks/coverage/typescript/tests/cases/compiler/styledComponentsInstantiaionLimitNotReached.ts -Mismatch: tasks/coverage/typescript/tests/cases/compiler/substitutionTypeForIndexedAccessType2.ts - Mismatch: tasks/coverage/typescript/tests/cases/compiler/tryStatementInternalComments.ts Mismatch: tasks/coverage/typescript/tests/cases/compiler/unionSignaturesWithThisParameter.ts diff --git a/tasks/prettier_conformance/snapshots/prettier.ts.snap.md b/tasks/prettier_conformance/snapshots/prettier.ts.snap.md index 5a373626111c5..04d9a7deee59f 100644 --- a/tasks/prettier_conformance/snapshots/prettier.ts.snap.md +++ b/tasks/prettier_conformance/snapshots/prettier.ts.snap.md @@ -35,12 +35,12 @@ ts compatibility: 481/573 (83.94%) | typescript/comments/union.ts | 💥 | 83.33% | | typescript/compiler/anyIsAssignableToObject.ts | 💥 | 75.00% | | typescript/compiler/indexSignatureWithInitializer.ts | 💥 | 75.00% | -| typescript/conditional-types/comments.ts | 💥💥 | 60.21% | +| typescript/conditional-types/comments.ts | 💥✨ | 31.51% | | typescript/conditional-types/conditonal-types.ts | 💥✨ | 34.48% | | typescript/conditional-types/infer-type.ts | 💥✨ | 4.76% | | typescript/conditional-types/nested-in-condition.ts | 💥✨ | 15.79% | -| typescript/conditional-types/new-ternary-spec.ts | 💥💥 | 54.03% | -| typescript/conditional-types/parentheses.ts | 💥💥 | 60.24% | +| typescript/conditional-types/new-ternary-spec.ts | 💥💥 | 58.18% | +| typescript/conditional-types/parentheses.ts | 💥✨ | 15.22% | | typescript/conformance/classes/classDeclarations/classAbstractKeyword/classAbstractMixedWithModifiers.ts | 💥 | 86.67% | | typescript/conformance/types/functions/functionOverloadErrorsSyntax.ts | 💥 | 0.00% | | typescript/conformance/types/namespaceExportDeclaration/exportAsNamespace.d.ts | 💥 | 75.00% | @@ -86,7 +86,7 @@ ts compatibility: 481/573 (83.94%) | typescript/satisfies-operators/lhs.ts | 💥✨ | 35.00% | | typescript/tuple/trailing-comma-for-empty-tuples.ts | 💥💥💥 | 16.67% | | typescript/tuple/tuple.ts | 💥💥💥 | 87.50% | -| typescript/type-alias/conditional.ts | 💥 | 38.10% | +| typescript/type-alias/conditional.ts | 💥 | 47.62% | | typescript/type-alias/issue-9874.ts | 💥 | 0.00% | | typescript/type-arguments-bit-shift-left-like/3.ts | 💥 | 0.00% | | typescript/type-arguments-bit-shift-left-like/5.tsx | 💥 | 0.00% |