microsoft / microsoft/TypeScript

Language service: open Type.id

Abierto
#5,687 1 comentario 0 reacciones 0 asignados Ver en GitHub

Nadie ha tomado este issue todavía.

Domain: API Help Wanted Suggestion
Lenguaje dominante
Go
Estrellas
111k
Forks
14.3k
Merge medio
2 d 4 h
PR fusionados (30 d)
132

Descripción

I am using language service to "traverse" the program, and I would like very much to "remember" which types and symbols I already saw, and to cache my computation results for them. Performance boost and avoiding infinite loops.

The compiler very helpfully supplies id for Type, Symbol and Node, and it seems to be "really, really" unique for symbols and nodes, and "relatively unique" (i.e. within a given typechecker) for types.

The problem is, however, that, unlike nodes and symbols, types hide their ids behind the "internal" qualifier and the lack of accessor function, making them not legally visible to me as a consumer of the language service. Of course, this being JavaScript, nothing prevents me from accessing them anyway, and that is what I currently do, but this is not ideal, because I am not protected from the code evolution in the future.

So it seems to me that nothing stands in the way of adding a getTypeId method to the typechecker, unless I'm missing something very important.

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 src/compiler/checker.ts y src/compiler/types.ts, especialmente con la definición de Type y el manejo existente de la identidad del typechecker descrito en el issue. Traza cómo se declaran y prueban las API públicas de language-service y type-checker, determina después qué se necesita para un accessor compatible del identificador de tipo y verifica que el identificador expuesto siga siendo útil dentro de un typechecker.

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

Evaluación

Stack tecnológico
typescript
Área
api, compilers
Tipo de issue
Nueva funcionalidad
Dificultad
4/5
Tiempo estimado
3-5 días
Estado de actividad
Estancado
Claridad
Bien especificado
Aptitud para principiantes
35/100

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.