Library definition enriched with diagnostic, state-key, and tracing helpers by createTypeSpecLibrary .
Type Parameter Default type T extends object- E extends Record<string, any>Record<string, never>State extends stringnever
Property Modifier Type Description Overrides Inherited from alias?readonlystringOptional short alias for this library used in diagnostic and linter rule codes. When provided, diagnostic/linter codes can be referenced as ${alias}/${code} in addition to the full ${name}/${code} form (e.g. tcgc/no-foo). Overrides the automatically scope-stripped short name. - TypeSpecLibraryDef .alias capabilities?readonlyTypeSpecLibraryCapabilitiesOptional registration of capabilities the library/emitter provides - TypeSpecLibraryDef .capabilities diagnosticsreadonlyDiagnosticMap <T>Map of potential diagnostics that can be emitted in this library where the key is the diagnostic code. - TypeSpecLibraryDef .diagnostics emitter?readonlyobjectEmitter configuration if library is an emitter. Its optional options JSON Schema validates custom configuration before the emitter runs; omit it when no schema is supplied. - TypeSpecLibraryDef .emitteremitter.options?publicJSONSchemaType <E>- - - namereadonlystringLibrary name TypeSpecLibraryDef .name- requireImports?readonlyreadonly string[] List of other library that should be imported when this is used as an emitter. Compiler will emit an error if the libraries are not explicitly imported. - TypeSpecLibraryDef .requireImports state?readonlyRecord<State, StateDef >Named state definitions used to create the corresponding symbols in the library’s stateKeys map. - TypeSpecLibraryDef .state stateKeysreadonlyRecord<State, symbol>Symbols for declared state names, registered as <library-name>/<state-name> for program state maps and sets. - -
createDiagnostic < C , M >(diag): Diagnostic;
Creates a library-qualified diagnostic without reporting it; the caller owns reporting or returning it.
Type Parameter C extends string | number | symbolM extends string | number | symbol
Diagnostic
createStateSymbol (name): symbol;
Get or create a symbol with the given name unique for that library.
Parameter Type Description namestringSymbol name scoped with the library name.
symbol
getTracer (program): Tracer;
Returns a tracer scopped to the current library.
All trace area logged via this tracer will be prefixed with the library name.
Tracer
reportDiagnostic < C , M >(program, diag): void ;
Creates a library-qualified diagnostic and reports it through the program’s reporting policies.
Type Parameter C extends string | number | symbolM extends string | number | symbol
void