microsoft / microsoft/TypeScript

Return export nodes of ast when resolving alias symbol

Offen
#36,972 1 Kommentar 1 Reaktion 0 zugewiesene Personen Auf GitHub ansehen

Dieses Issue hat noch niemand übernommen.

Awaiting More Feedback Suggestion
Vorherrschende Sprache
Go
Sterne
111k
Forks
14.3k
Ø Merge
2 T. 4 Std.
Gemergte PRs (30 T.)
132

Beschreibung

Search Terms

export star node

Suggestion

Add an API which returns alias symbol of import specifier and the export nodes on the searching path.

Use Cases

I want to write a little tool to extract certain type in typescript code and its dependent types.
Current approaches just return the alias symbol, and it's difficult to establish relationship between import specifier and export star statements.

Examples

a.ts:

import {C} from './b';

b.ts:

export * from './c';
export * from './d';
export * from './e';

c.ts:

export const C = 1;

I want to get not only the location of symbol "C", but also the export star node in the AST of "b.ts", which is "export * from './c'".

Checklist

My suggestion meets these guidelines:

  • This wouldn't be a breaking change in existing TypeScript/JavaScript code
  • This wouldn't change the runtime behavior of existing JavaScript code
  • This could be implemented without emitting different JS based on the types of the expressions
  • This isn't a runtime feature (e.g. library functionality, non-ECMAScript syntax with JavaScript output, etc.)
  • This feature would agree with the rest of TypeScript's Design Goals.

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

Es werden keine Dateien, Tests oder Compiler-Einstiegspunkte genannt. Beginne damit, nachzuverfolgen, wie Alias-Symbole und Export-Star-Deklarationen für den Import im Beispiel aufgelöst werden; die Arbeit ist abgeschlossen, wenn eine öffentliche API sowohl das Alias-Symbol als auch die Exportknoten auf dem Suchpfad zurückgibt, ohne das erzeugte JavaScript zu ändern.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Bewertung

Tech-Stack
typescript
Bereich
compilers
Issue-Typ
Feature
Schwierigkeit
5/5
Geschätzter Aufwand
Über eine Woche
Aktivitätsstatus
Veraltet
Klarheit
Größtenteils klar
Anfängerfreundlichkeit
35/100

Neue Issues direkt in Ihr Postfach

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