microsoft / microsoft/TypeScript

`{@link Class.name}` resolves wrongly to `Function.name`

Abierto
#61,433 4 comentarios 1 reacción 1 asignado Ver en GitHub

@sandersn ya está trabajando en esto.

Desde el 20/3/2025.

Needs Investigation
Lenguaje dominante
Go
Estrellas
111k
Forks
14.3k
Merge medio
2 d 4 h
PR fusionados (30 d)
132

Descripción

### 🔎 Search Terms

JSDoc, TSDoc, Link, Resolve, Name

### 🕗 Version & Regression Information

- This is the behavior in every version I tried, and I reviewed the FAQ for entries

### ⏯ Playground Link

https://www.typescriptlang.org/play/?ts=5.8.0-dev.20250215#code/MYGwhgzhAEAqCmEAu0DeBYAUNH0D0AVAVrjgdABLwggD2JpBeDOAdmALbwBcyATgEtWAc2gBeaACIEySVgC+WLIWLZyqAAIghAaziIkAOnZdFa5pgBmAV1bAkA2q2hgAFEm4ykASjQtofPBI1nzORibwANwKQA

### 💻 Code

```ts
class Test {
/**
* Hello
*/
name:string = "Test"
}

/**
* {@link Test.name}
*/
function a(t:Test) {
return t.name;
}
```

### 🙁 Actual behavior

The `Test.name` reference in the JSDoc/TSDoc resolves to the symbol `Function.name`. This is not correct because the `Test` class has an own property declaration for `name`.

In my real world usecase am generating markdowns from my typescript code via TypeScript compiler API and I get the wrong symbol using `typeChecker.getSymbolAtLocation(tsDocLinkNode.name)` leading to wrong documentation links.

![Image](https://github.com/user-attachments/assets/cc671d23-07b4-4aea-8529-15e1608a7a81)

### 🙂 Expected behavior

The correct documentation of my `name` property should be shown.

The typeChecker should resolve this expression to the correct symbol to allow tooling to resolve these cross references and link to the respective documentation page.

### Additional information about the issue

_No response_

Guía de contribución

Abrir la guía de contribución

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Evaluación

Este issue todavía no se ha evaluado.

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.