[I] TypeSpecLibrary
Extends
Section titled “Extends”TypeSpecLibraryDef<T,E,State>
Type Parameters
Section titled “Type Parameters”| Type Parameter | Default type |
|---|---|
T extends object | - |
E extends Record<string, any> | Record<string, never> |
State extends string | never |
Properties
Section titled “Properties”| Property | Modifier | Type | Description | Overrides | Inherited from |
|---|---|---|---|---|---|
capabilities? | readonly | TypeSpecLibraryCapabilities | Optional registration of capabilities the library/emitter provides | - | TypeSpecLibraryDef.capabilities |
diagnostics | readonly | DiagnosticMap<T> | Map of potential diagnostics that can be emitted in this library where the key is the diagnostic code. | - | TypeSpecLibraryDef.diagnostics |
emitter? | readonly | object | Emitter configuration if library is an emitter. | - | TypeSpecLibraryDef.emitter |
emitter.options? | public | JSONSchemaType<E> | - | - | - |
name | readonly | string | Library name | TypeSpecLibraryDef.name | - |
requireImports? | readonly | readonly 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? | readonly | Record<State, StateDef> | - | - | TypeSpecLibraryDef.state |
stateKeys | readonly | Record<State, symbol> | - | - | - |
Methods
Section titled “Methods”createDiagnostic()
Section titled “createDiagnostic()”createDiagnostic<C, M>(diag): Diagnostic;Type Parameters
Section titled “Type Parameters”| Type Parameter |
|---|
C extends string | number | symbol |
M extends string | number | symbol |
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
diag | DiagnosticReport<T, C, M> |
Returns
Section titled “Returns”createStateSymbol()
Section titled “createStateSymbol()”createStateSymbol(name): symbol;Get or create a symbol with the given name unique for that library.
Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
name | string | Symbol name scoped with the library name. |
Returns
Section titled “Returns”symbol
getTracer()
Section titled “getTracer()”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.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
program | Program |
Returns
Section titled “Returns”reportDiagnostic()
Section titled “reportDiagnostic()”reportDiagnostic<C, M>(program, diag): void;Type Parameters
Section titled “Type Parameters”| Type Parameter |
|---|
C extends string | number | symbol |
M extends string | number | symbol |
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
program | Program |
diag | DiagnosticReport<T, C, M> |
Returns
Section titled “Returns”void