microsoft / microsoft/TypeScript

Go-to-definition should only show relevant definitions when value & type have same name

Abierto
#57,959 6 comentarios 3 reacciones 0 asignados Ver en GitHub

Nadie ha tomado este issue todavía.

Awaiting More Feedback Suggestion
Lenguaje dominante
Go
Estrellas
111k
Forks
14.4k
Merge medio
1 d 19 h
PR fusionados (30 d)
117

Descripción

🔎 Search Terms

"go to definition", "same identifier", "value", "type"

🕗 Version & Regression Information

Always was the case, AFAIK

⏯ Playground Link

https://www.typescriptlang.org/play?#code/C4TwDgpgBMULxQN4F8oFgBQmDGB7AdgM6ywIrpYYBmArvtsAJYFRUAUAhgE4DmAXDACUSKKgD0YqD1yN8PGLigATCFVmMmLFgANg2qAAsIXCIGgCKYwBuEQstXrNRKLipQARrmAGoAWhjhoDnwlKEsOABsaaF1tABooCGt8GANcGh5vMMjovShsIPxPd2gaQggQ2RTGWzBwjmwIAWBCbF8Eri5cLigAFQBlACYAdgAWAE4BAHJgSagTKmNbYEUOUIio+LcaWGri2XlS8qgOW1XQSENjCAA6KAARRhCQNKgAWwggqGmAlxhJgH5MJggA

💻 Code
type t = {} 

const t = {} 

function f(arg: t) { } // going to definition on `t` here​ gives definitions of both - type and value `t`, even though value `t` cannot be used in this place: tsc - error TS2749: 't' refers to a value, but is being used as a type here. Did you mean 'typeof t'?

🙁 Actual behavior

"Go to definition" on a param type t shows 2 definitions - value & type which have same name - even though the value's definition is completely irrelevant.

🙂 Expected behavior

"Go to definition" shows only relevant definition of type t

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.

Línea de trabajo

Comienza con la reproducción en Playground y la solicitud go-to-definition para la t en function f(arg: t). Rastrea cómo el servicio de lenguaje resuelve las definiciones cuando un tipo y un valor comparten nombre; se considera terminado cuando el resultado contiene únicamente la definición del tipo, mientras se conservan las definiciones relevantes en otros contextos.

Escrito por el modelo de indexación a partir del texto del issue.

Evaluación

Stack tecnológico
typescript
Área
devtools
Tipo de issue
Error
Dificultad
4/5
Tiempo estimado
3-5 días
Estado de actividad
Estancado
Claridad
Bien especificado
Aptitud para principiantes
45/100

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.