-
Notifications
You must be signed in to change notification settings - Fork 653
feat: Support TS satisfies expression #3846
feat: Support TS satisfies expression #3846
Conversation
✅ Deploy Preview for docs-rometools canceled.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is awesome work! Well done and thank you
There's one failing test that needs updating before merging the PR |
@@ -2756,6 +2756,44 @@ impl IntoFormat<crate::JsFormatContext> for rome_js_syntax::TsAsExpression { | |||
) | |||
} | |||
} | |||
impl FormatRule<rome_js_syntax::TsSatisfiesExpression> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@MichaReiser should we add this file to .gitattributes
?
if TypeScript.is_unsupported(p) { | ||
p.error(ts_only_syntax_error( | ||
p, | ||
"'satisfies' expression", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we add a test where we emit this new diagnostic? Ideally, just a JS file with this new syntax, should be enough.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I added in 8e31e54 !
After checking one failing test, I confirmed the tests will pass by commenting out this line in check_reformat.rs. And then, I confirmed the formatted result is not different from prettiter's one so I removed |
I pushed a commit that handles leading own line comments by creating an indent around the type. The resulting formatting differs from Prettier but is stable. |
Fix #3748
Summary
This PR is initial implementation for satisfies expression released in TS.4.9.
This is almost same as the implementation of TsAsExpression.
Test Plan
I added some parser and formatter tests. Also, I updated prettier tests about satisfies expression.
I was able to pass most of the Prettier test cases except for
comments-unstable.ts
. As forcomments-unstable.ts
, I don't understand how to pass it. I would appreciate it if you could give me some advice.