TypeScript icon indicating copy to clipboard operation
TypeScript copied to clipboard

Compiler API: convert a synthesized SourceFile to a real SourceFile

Open Jack-Works opened this issue 3 years ago • 0 comments

Suggestion

Have some way to convert a synthesized SourceFile to a real SourceFile that can be used in type checking.

Currently, this kind of SourceFile crashes the compiler because it lacks so much information (e.g. directives, parse tree)

🔍 Search Terms

compiler API parse

💻 Use Cases

Create a new SourceFile from AST Node that can be type checked via Program.emit(). Now I need to print the source file and re-parse it, it's a performance waste.

Jack-Works avatar Nov 03 '22 07:11 Jack-Works