fix(compiler): preserve dangling comments in empty operation parameter list#10351
Merged
timotheeguerin merged 2 commits intomicrosoft:mainfrom Apr 13, 2026
Merged
Conversation
…r list `tsp format` crashed on `op find(/* conditions */): unknown;` because `printModelExpression` discarded dangling comments when the property list was empty, tripping prettier's `ensureAllCommentsPrinted` check. Print dangling comments in that branch so the block comment survives formatting.
Contributor
Author
|
@microsoft-github-policy-service agree |
commit: |
Contributor
|
All changed packages have been documented.
Show changes
|
Member
timotheeguerin
left a comment
There was a problem hiding this comment.
@tokuhirom thanks for the fix, looks like just need to run pnpm format
timotheeguerin
approved these changes
Apr 13, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
tsp formatcrashed on:with
TypeError: Cannot read properties of undefined (reading 'trim')from prettier's ensureAllCommentsPrinted.
Root cause
printModelExpression (used for operation parameter lists) returned an
empty string when the property list was empty, dropping any dangling
comments. Prettier then detected an unprinted comment and threw.
Fix
Print dangling comments in the empty-properties branch so the block
comment survives formatting.
Test
Added keeps block comment in empty parameter list to
formatter.test.ts. All 199 formatter tests pass.