microsoft / microsoft/TypeScript
Please document compiler APIs
Nadie ha tomado este issue todavía.
- Lenguaje dominante
- Go
- Estrellas
- 111k
- Forks
- 14.3k
- Merge medio
- 1 d 19 h
- PR fusionados (30 d)
- 117
Descripción
Would it be possible to get some documentation on the compiler APIs?
I am working on some TypeScript tooling, and I am using ts.createSourceFile() to get the AST for a TypeScript source file. However, the tree in SourceFile.statements is missing some information. For example, I need to know the type of an Expression when a PropertyDeclaration only has an initializer but no declared type. I have tried TypeChecker.getContextualType() but it always returns undefined; also the implementation doesn't look right. There are internal methods like TypeChecker.getTypeOfExpression() that look promising, but they are not visible. Also I read some mention of 'bindings', but I haven't found a way to get them.
Another example is type resolution: When I encounter a TypeNode or something similar within the AST, I usually need to know about its declaration: Where does it come from? Is it local? Where is it imported from? Of course I can write that myself with some effort, but surely such logic already exists within the compiler, I just don't know where.
Guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Línea de trabajo
Comienza revisando las áreas de la API del compilador mencionadas en el issue: ts.createSourceFile(), SourceFile.statements, TypeChecker.getContextualType(), getTypeOfExpression(), bindings y la resolución de tipos. Documenta las APIs públicas compatibles para obtener tipos de expresiones y declaraciones, incluido cómo se identifican los imports y las declaraciones locales; se considerará terminado cuando estos flujos de trabajo estén explicados claramente para los autores de herramientas de TypeScript.
Escrito por el modelo de indexación a partir del texto del issue.
Evaluación
- Stack tecnológico
- typescript
- Área
- compilers, documentation
- Tipo de issue
- Documentación
- Dificultad
- 5/5
- Tiempo estimado
- Más de una semana
- Estado de actividad
- Estancado
- Claridad
- Necesita aclaración
- Aptitud para principiantes
- 20/100