Skip to content

Don't inherit JSDocs from unrelated base properties onto constructor parameters with the same names#62077

Closed
Andarist wants to merge 1 commit intomicrosoft:mainfrom
Andarist:fix/dont-inherit-jsdoc-on-unrelated-params
Closed

Don't inherit JSDocs from unrelated base properties onto constructor parameters with the same names#62077
Andarist wants to merge 1 commit intomicrosoft:mainfrom
Andarist:fix/dont-inherit-jsdoc-on-unrelated-params

Conversation

@Andarist
Copy link
Copy Markdown
Contributor

fixes #62069

Copilot AI review requested due to automatic review settings July 15, 2025 22:30
@github-project-automation github-project-automation bot moved this to Not started in PR Backlog Jul 15, 2025
@typescript-bot typescript-bot added the For Backlog Bug PRs that fix a backlog bug label Jul 15, 2025
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 findBaseOfDeclaration to 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

@typescript-bot
Copy link
Copy Markdown
Collaborator

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:

  • For crash bugfixes or language service improvements, PRs are currently accepted at the typescript-go repo
  • Changes to type system behavior should wait until after 7.0, at which point mainline TypeScript development will resume in this repository with the Go codebase
  • Library file updates (lib.d.ts etc) continue to live in this repo or the DOM Generator repo as appropriate

@github-project-automation github-project-automation bot moved this from Not started to Done in PR Backlog Mar 24, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

For Backlog Bug PRs that fix a backlog bug

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

Derived class constructor parameter incorrectly inherits JSDoc from parent class's field of the same name

4 participants