microsoft / microsoft/TypeScript
Compiler API: Expose More from typescript.d.ts
Nessuno ha ancora preso questa issue.
- Lingua principale
- Go
- Stelle
- 111k
- Fork
- 14.3k
- Merge medio
- 2g 4h
- PR unite (30g)
- 132
Descrizione
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
Guida per i contributori
Apri la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Direzione di ricerca
Inizia con le dichiarazioni pubbliche in typescript.d.ts e confronta i membri indicati Node.locals, Symbol.parent, getContainingFunction e isAssignmentTarget con le relative implementazioni nel compilatore. Risolvi le questioni sollevate riguardo all'API e ai tipi restituiti, quindi verifica che i membri previsti siano esposti in modo coerente ai consumer di Compiler API.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Valutazione
- Stack tecnologico
- typescript
- Ambito
- compilers
- Tipo di issue
- Funzionalità
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Stato di attività
- Ferma
- Chiarezza
- Abbastanza chiara
- Idoneità per principianti
- 30/100