Skip to content

fix: resolve JSDoc '#' links to instance members - #65515

Open
刘亦达 (zhengdaodeguL) wants to merge 1 commit into
microsoft:mainfrom
zhengdaodeguL:fix/jsdoc-hash-link-instance-65507
Open

刘亦达 (zhengdaodeguL) wants to merge 1 commit into
microsoft:mainfrom
zhengdaodeguL:fix/jsdoc-hash-link-instance-65507

Conversation

@zhengdaodeguL

Copy link
Copy Markdown

Fixes #65507

Background

Foo#member should resolve to the instance member (see #61433), but in
TS 7 it resolves to the static member; TS 6 behaves correctly.
resolveJSDocMemberName calls resolveEntityName first, which finds the
static class export before the prototype/instance fallback can run. The Go
parser stores both . and # spellings as qualified names, but the source
span between the left and right names still preserves which separator was
used.

Change

  • Detect hash links from the source separator (isJSDocHashLinkMemberName)
    and skip the static-first entity lookup for them, resolving through the
    left symbol's prototype/instance type instead. Dot-qualified links keep
    the existing static-first behavior.
  • Add an early hash-link path in getSymbolOfNameOrPropertyAccessExpression
    so ordinary qualified-name checking cannot cache a static result first.
  • A hash link with no matching instance member resolves to nothing (TS 6
    parity: no fallback to a same-named static member).

Adds TestJSDocHashLinkResolvesToInstanceMember, covering the static link,
the instance link, and a hash link with no instance member.

Verification

  • go test -run '^TestJSDocHashLinkResolvesToInstanceMember$' ./internal/checker
    — pass; the new test fails on base code.
  • go test ./internal/checker (full package) — pass.
  • go build ./cmd/tsc — pass.
  • gofmt -l clean on both changed files; git diff --check clean.

Not run: full npx hereby test (too large for this environment; only the
targeted Go tests were run), npx hereby lint, npx hereby check:format.

Copilot AI balanced review requested due to automatic review settings November 15, 2026 15:04
@typescript-automation typescript-automation Bot added the For Uncommitted Bug PR for untriaged, rejected, closed or missing bug label Nov 15, 2026
@github-project-automation github-project-automation Bot moved this to Not started in PR Backlog Nov 15, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.

@typescript-automation typescript-automation Bot added For Backlog Bug PRs that fix a backlog bug and removed For Uncommitted Bug PR for untriaged, rejected, closed or missing bug labels Nov 17, 2026

This branch has not been deployed

No deployments
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: Not started

Development

Successfully merging this pull request may close these issues.

JSDoc # link resolution behavior broke in TS 7

2 participants