microsoft / microsoft/TypeScript

Language service: open Type.id

Offen
#5,687 1 Kommentar 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen

Dieses Issue hat noch niemand übernommen.

Domain: API Help Wanted Suggestion
Vorherrschende Sprache
Go
Sterne
111k
Forks
14.3k
Ø Merge
1 T. 19 Std.
Gemergte PRs (30 T.)
117

Beschreibung

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.

Beitragsleitfaden

Beitragsleitfaden öffnen

Erste Schritte

  1. Lies das ganze Issue und danach den Beitragsleitfaden des Projekts.
  2. Schreib ins Issue, dass du es übernimmst — das erspart doppelte Arbeit.
  3. Forke das Repository und arbeite in einem Branch.
  4. Öffne einen Pull Request, der die Issue-Nummer nennt.

Rechercherichtung

Beginne mit src/compiler/checker.ts und src/compiler/types.ts, insbesondere mit der Type-Definition und der bestehenden Identity-Behandlung des Typecheckers, die im Issue beschrieben wird. Verfolge, wie öffentliche Language-Service- und Type-Checker-APIs deklariert und getestet werden, ermittle dann, was für einen unterstützten Zugriff auf den Typbezeichner erforderlich ist, und überprüfe, ob der offengelegte Bezeichner innerhalb eines Typecheckers weiterhin nützlich ist.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Bewertung

Tech-Stack
typescript
Bereich
api, compilers
Issue-Typ
Feature
Schwierigkeit
4/5
Geschätzter Aufwand
3-5 Tage
Aktivitätsstatus
Veraltet
Klarheit
Klar beschrieben
Anfängerfreundlichkeit
35/100

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.