Fix JSDoc disappearing on destructured parameters from intersection types#3408
Draft
Fix JSDoc disappearing on destructured parameters from intersection types#3408
Conversation
…ypes When hovering over a destructured parameter from an intersection type, JSDoc from constituent type properties was lost because the merged property symbol has ValueDeclaration=nil when constituent declarations differ. Now also searches through all Declarations of the property symbol to find JSDoc. Agent-Logs-Url: https://github.com/microsoft/typescript-go/sessions/03190eda-c134-4456-aefb-bccb4e85832c Co-authored-by: jakebailey <5341706+jakebailey@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Fix JSDoc disappearing after type calculation
Fix JSDoc disappearing on destructured parameters from intersection types
Apr 15, 2026
Andarist
reviewed
Apr 15, 2026
| if foundJsdoc := getJSDocOrTag(c, decl); foundJsdoc != nil { | ||
| jsdoc = foundJsdoc | ||
| declaration = decl | ||
| break |
Contributor
There was a problem hiding this comment.
FWIW, Strada would actually combine the doc string for multiple declarations:
https://github.com/microsoft/TypeScript/blob/c7a0ae102dfb030c534a7bc31fbbd61a707dc9cf/src/services/jsDoc.ts#L187-L222
Member
There was a problem hiding this comment.
@copilot I have no idea what you did. You need to think about this comment
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.
Hovering over a destructured parameter from an intersection type lost JSDoc from constituent properties:
Root cause: For intersection types with non-uniform declarations,
createUnionOrIntersectionPropertysetsValueDeclaration = nilon the merged symbol (while preserving all declarations inDeclarations). The hover code only checkedValueDeclaration.Fix: In
getDocumentationFromDeclaration, fall back to searchingpropertySymbol.DeclarationswhenValueDeclarationis nil or lacks JSDoc.