| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
The emitter is a tree based syntax emitter. It works by going through the TypeScript AST for a program and emitting source code as it is pipelined.
The emitter itself is "dumb" in the sense that it doesn't contain logic outside of printing whatever AST it is given. So, it's possible that a bug in emission is actually that the AST isn't set up the way that you'd like it.
Creating a single file which represents many is done by creating a SyntaxKind.Bundle. Printing happens in function writeBundle(. There are prepends which I don't understand, and then each sourcefile is is printed.
The printer is a part of the emitter, you create one with createPrinter, then start calling print with an AST node on it. This adds the node via a pipeline:
const enum PipelinePhase {
Notification,
Substitution,
Comments,
SourceMaps,
Emit,
}With the word to start emitting through the AST in [pipelineEmitWithHint][4]. There is a hint option which can be used to force the emit type.
The process of changing your AST into the expected JS or TS happens the emitter compiler transformers. There is a full step
Emitting a declaration file is a multi-step process. It goes through the above emitter of its AST, but then also goes through a
News
Debugging TypeScript
Contributing to TypeScript
Building Tools for TypeScript
FAQs
The Main Repo
| Back | FazBrowse Home | New Git URL |