Skip to content

[WIP] Fix accessing name on jsdoc link for invalid names - #64032

Draft
Andrew Branch (andrewbranch) with Copilot wants to merge 1 commit into
mainfrom
copilot/fix-jsdoc-link-name-access
Draft

[WIP] Fix accessing name on jsdoc link for invalid names#64032
Andrew Branch (andrewbranch) with Copilot wants to merge 1 commit into
mainfrom
copilot/fix-jsdoc-link-name-access

Conversation

Copilot AI commented Aug 26, 2026

Copy link
Copy Markdown
Contributor

Thanks for asking me to work on this. I will get started on it and keep this PR's description up to date as I form a plan and make progress.


This section details on the original issue you should resolve

<issue_title>[7.0 API] - Accessing name on a jsdoc link that does not have a valid name produces sibling node</issue_title>
<issue_description>### 🔎 Search Terms

jsdoc link name

🕗 Version & Regression Information

  • This changed between versions 6 and 7

⏯ Playground Link

Playground Link

💻 Code

/**
* {@link #toggled} property
*/
export const x = 1;

🙁 Actual behavior

Using the TS API to get the name jsdoc link tag produces node containing JSDocText property (the next sibling node)

import { API } from "@typescript/native-preview/unstable/sync";
import { createVirtualFileSystem } from "@typescript/native-preview/unstable/fs";

const code = `/**
* {@link #toggled} property
*/
export const x = 1;`;

const api = new API({
  fs: createVirtualFileSystem({
    "/tsconfig.json": "{}",
    "/src/sample.ts": code,
  }),
});

const snapshot = api.updateSnapshot({ openProject: "/tsconfig.json" });
const project = snapshot.getProject("/tsconfig.json")!;
const sourceFile = project.program.getSourceFile("/src/sample.ts")!;
const statement = sourceFile.statements[0];

// Should be undefined. Returns `property`
console.log(statement.jsDoc[0].comment[1].name?.getText())

🙂 Expected behavior

The name property of the link should be undefined as in 6.0

import ts from "typescript";

const code = `/**
     * {@link #toggled} property
     */
    export const x = 1;`;

const file = ts.createSourceFile("sample.ts", code, ts.ScriptTarget.Latest, true);
const statement = file.statements[0];

// undefined, since #toggle is  not a valid entity name
console.log(statement.jsDoc[0].comment[1].name?.getText());

Additional information about the issue

No response</issue_description>

Comments on the Issue (you are Copilot in this section)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[7.0 API] - Accessing name on a jsdoc link that does not have a valid name produces sibling node

2 participants