Per-emitter compilation context supplied to $onEmit, including options and performance reporting.
| Type Parameter | Default type |
|---|
TOptions extends object | Record<string, never> |
| Property | Modifier | Type | Description |
|---|
createScope | readonly | (overrides) => Scope | Derive a scope from this emitter’s scope, overriding the given dimensions. Use this when a single emitter produces output for more than one scope — for example a client emitter that targets several languages, or one that emits both client and server artifacts from the same program. Example const csharp = context.createScope({ language: "csharp", target: "client" }); const name = getAutoDecoratorValue(program, "MyLib.clientName", model, csharp); |
emitterOutputDir | public | string | Resolved output directory for this emitter, including its configured override if any. Emit all output beneath this directory rather than the program’s shared output directory. |
options | public | TOptions | Custom options configured for this emitter, validated when the library declares an options schema. The compiler’s emitter-output-dir option is removed and exposed as emitterOutputDir instead. |
perf | readonly | PerfReporter | Performance measurement utilities. Use this to report performance of areas of your emitter. The information will be displayed when the compiler is run with --stats flag. |
program | public | Program | Checked program being emitted. Use its reporting APIs to report emitter diagnostics. |
scope | readonly | Scope | The scope this emitter is running under, used to resolve when-conditioned metadata. The emitter dimension is populated automatically from the emitter’s package name. Emitters that serve a specific language or artifact kind should narrow it further with EmitContext.createScope. |