microsoft / microsoft/TypeScript
Compiler API: Expose More from typescript.d.ts
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
TypeScript Version: 2.9.0-dev.20180426
While Traversing the TypeScript AST of a source file, there have been a number of helpful things I've found by extending ts.* from typescript.d.ts and I would like it if these could be exposed (or not marked /* @internal */).
Search Terms:
typescript.d.ts
Node.locals
Symbol.parent
getContainingFunction
isAssignmentTarget
Code
declare namespace ts {
interface Node {
/* @internal */ readonly locals?: SymbolTable; // Locals associated with node (initialized by binding)
}
interface Symbol {
/* @internal */ readonly parent?: Symbol; // Parent symbol
}
function getContainingFunction(node: Node): SignatureDeclaration | undefined;
function isAssignmentTarget(node: Node): boolean;
}
Note:
- Added
readonlyforNode#locals&Symbol#parent - For
Symbol#parent, the goal is: given the symbol for a method (e.g.,methodSymbolforNumber#toString) find where that method is defined (e.g.,Number)... maybeprogram.getTypeChecker().getSymbolAtLocation(methodSymbol.valueDeclaration.parent)is what is "supposed" to be used instead? - For
ts.getContainingFunction()it seems more appropriate to have a return type ofSignatureDeclaration | undefinedinstead ofSignatureDeclaration
Related Issues:
#15841
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 con las declaraciones públicas de typescript.d.ts y compara los miembros indicados Node.locals, Symbol.parent, getContainingFunction e isAssignmentTarget con sus implementaciones en el compilador. Resuelve las preguntas planteadas sobre la API y los tipos de retorno, y verifica después que los miembros previstos estén expuestos de forma coherente para los consumidores de Compiler API.
Escrito por el modelo de indexación a partir del texto del issue.
Evaluación
- Stack tecnológico
- typescript
- Área
- compilers
- Tipo de issue
- Nueva funcionalidad
- Dificultad
- 4/5
- Tiempo estimado
- 3-5 días
- Estado de actividad
- Estancado
- Claridad
- Bastante claro
- Aptitud para principiantes
- 30/100