-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Closed
Labels
Description
I think it would be better to generate code from an abstract syntax tree rather than using templates.
In the past, I have found the @babel/generator to be a solid choice for generating code from AST, however, that would not work for typescript. Perhaps, the getTextOfNode() method in the typescript compiler utilities would do the job.
This is definitely a much more flexible approach because it conforms to the user's style of choice. It also allows for dynamically modifying existing files without the huge risk of destroying code.