Skip to content

[I] Program

PropertyModifierTypeDescription
checkerpublicCheckerDANGER Using the checker is reserved for advanced usage and should be used with caution. API are not subject to the same stability guarantees see See https://typespec.io/docs/handbook/breaking-change-policy/
compilerOptionspublicCompilerOptions-
diagnosticsreadonlyreadonly Diagnostic[]-
emitterspublicEmitterRef[]-
hostpublicCompilerHost-
jsSourceFilespublicMap<string, JsSourceFileNode>-
projectRootreadonlystringProject root. If a tsconfig was found/specified this is the directory for the tsconfig.json. Otherwise directory where the entrypoint is located.
sourceFilespublicMap<string, TypeSpecScriptNode>All source files in the program, keyed by their file path.
tracerpublicTracer-
getGlobalNamespaceType(): Namespace;

Namespace


getSourceFileLocationContext(sourceFile): LocationContext;

Return location context of the given source file.

ParameterType
sourceFileSourceFile

LocationContext


hasError(): boolean;

boolean


reportDiagnostic(diagnostic): void;
ParameterType
diagnosticDiagnostic

void


reportDiagnostics(diagnostics): void;
ParameterType
diagnosticsreadonly Diagnostic[]

void


resolveTypeReference(reference): [undefined | Type, readonly Diagnostic[]];
ParameterType
referencestring

[undefined | Type, readonly Diagnostic[]]


stateMap(key): Map<Type, any>;
ParameterType
keysymbol

Map<Type, any>


stateSet(key): Set<Type>;
ParameterType
keysymbol

Set<Type>


trace(area, message): void;
ParameterType
areastring
messagestring

void