Don't inherit JSDocs from unrelated base properties onto constructor parameters with the same names#62077
Conversation
…parameters with the same names
There was a problem hiding this comment.
Pull Request Overview
This PR fixes an issue where JSDoc comments from base class properties were incorrectly being inherited by constructor parameters that happened to have the same name. The fix ensures that JSDoc inheritance only occurs for constructor parameters that are actually property declarations (those with accessibility modifiers like public, private, or protected).
- Modifies the logic in
findBaseOfDeclarationto check for accessibility modifiers on constructor parameters - Adds a test case to verify that regular constructor parameters don't inherit JSDoc from unrelated base class properties
Reviewed Changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
src/services/services.ts |
Updates JSDoc inheritance logic to only apply to constructor parameters with accessibility modifiers |
tests/cases/fourslash/jsDocDontInheritFromSameNamedPropertyOnParameter1.ts |
Adds test case verifying constructor parameters don't inherit unrelated JSDoc |
|
With 6.0 out as the final release vehicle for this codebase, we're closing all PRs that don't fit the merge criteria for post-6.0 patches. If you think this was a mistake and this PR fits the post-6.0 patch criteria, please post to the 6.0 iteration issue with details (specifically, which PR and which patch criteria it satisfies). Next steps for PRs:
|
fixes #62069