microsoft / microsoft/TypeScript

Return export nodes of ast when resolving alias symbol

Aperta
#36,972 1 commento 1 reazione 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Awaiting More Feedback Suggestion
Lingua principale
Go
Stelle
111k
Fork
14.3k
Merge medio
2g 4h
PR unite (30g)
132

Descrizione

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.

Guida per i contributori

Apri la guida per i contributori

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Direzione di ricerca

Non vengono indicati file, test o punti di ingresso del compilatore. Inizia tracciando come vengono risolti i simboli alias e le dichiarazioni export-star per l'import nell'esempio; il lavoro è completo quando una API pubblica restituisce sia il simbolo alias sia i nodi di esportazione sul percorso di ricerca, senza modificare il JavaScript emesso.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Valutazione

Stack tecnologico
typescript
Ambito
compilers
Tipo di issue
Funzionalità
Difficoltà
5/5
Tempo stimato
Più di una settimana
Stato di attività
Ferma
Chiarezza
Abbastanza chiara
Idoneità per principianti
35/100

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.