microsoft / microsoft/TypeScript
Language service: open Type.id
Nessuno ha ancora preso questa issue.
- Lingua principale
- Go
- Stelle
- 111k
- Fork
- 14.3k
- Merge medio
- 2g 4h
- PR unite (30g)
- 132
Descrizione
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.
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 src/compiler/checker.ts e src/compiler/types.ts, prestando particolare attenzione alla definizione di Type e alla gestione esistente dell’identità del typechecker descritta nell’issue. Traccia come vengono dichiarate e testate le API pubbliche di language-service e type-checker, quindi determina cosa è necessario per un accessor supportato dell’identificatore di tipo e verifica che l’identificatore esposto rimanga utile all’interno di un typechecker.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Valutazione
- Stack tecnologico
- typescript
- Ambito
- api, compilers
- Tipo di issue
- Funzionalità
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Stato di attività
- Ferma
- Chiarezza
- Specificata chiaramente
- Idoneità per principianti
- 35/100