Skip to content

[I] TypeSpecLibrary

Type ParameterDefault type
T extends object-
E extends Record<string, any>Record<string, never>
State extends stringnever
PropertyModifierTypeDescriptionOverridesInherited from
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.-TypeSpecLibraryDef.emitter
emitter.options?publicJSONSchemaType<E>---
namereadonlystringLibrary nameTypeSpecLibraryDef.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>--TypeSpecLibraryDef.state
stateKeysreadonlyRecord<State, symbol>---
createDiagnostic<C, M>(diag): Diagnostic;
Type Parameter
C extends string | number | symbol
M extends string | number | symbol
ParameterType
diagDiagnosticReport<T, C, M>

Diagnostic


createStateSymbol(name): symbol;

Get or create a symbol with the given name unique for that library.

ParameterTypeDescription
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.

ParameterType
programProgram

Tracer


reportDiagnostic<C, M>(program, diag): void;
Type Parameter
C extends string | number | symbol
M extends string | number | symbol
ParameterType
programProgram
diagDiagnosticReport<T, C, M>

void