Skip to content

[I] EmitContext

Type ParameterDefault type
TOptions extends objectRecord<string, never>
PropertyModifierTypeDescription
createScopereadonly(overrides) => ScopeDerive 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);
emitterOutputDirpublicstringConfigured output dir for the emitter. Emitter should emit all output under that directory.
optionspublicTOptionsEmitter custom options defined in createTypeSpecLibrary
perfreadonlyPerfReporterPerformance 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.
programpublicProgramTypeSpec Program.
scopereadonlyScopeThe 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.