microsoft / microsoft/TypeScript
Provide a way to clone a ast tree includes it's all children
Nessuno ha ancora preso questa issue.
- Lingua principale
- Go
- Stelle
- 111k
- Fork
- 14.3k
- Merge medio
- 2g 4h
- PR unite (30g)
- 132
Descrizione
Search Terms
api, plugin, transformer
Suggestion
Provide a way to clone an ast tree not only top level node but includes it's all children.
Use Cases
Currently, replace node with the original node is not work with textChanges(It will fail an assert).
So I have to do it like this: https://github.com/HearTao/ts-react-hooks-tools/blob/main/src/utils.ts#L458-L476.
I think It's not a good idea even it works.
Examples
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
- 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 esaminando l’utilizzo collegato di service.ts e il workaround in utils.ts per sostituire i nodi AST con textChanges. Traccia il modo in cui le API AST e transformer di TypeScript gestiscono i nodi figli e le modifiche al testo. Il lavoro è completato quando viene fornito un modo supportato per clonare un nodo AST insieme a tutti i suoi figli senza attivare l’errore di asserzione segnalato.
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
- 30/100