Skip to content

[I] TypeSpecLibraryDef

Definition supplied to createTypeSpecLibrary and typically exported as $lib.

Type ParameterDefault type
T extends object-
E extends Record<string, any>Record<string, never>
State extends stringnever
PropertyModifierTypeDescription
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.
capabilities?readonlyTypeSpecLibraryCapabilitiesOptional registration of capabilities the library/emitter provides
diagnosticsreadonlyDiagnosticMap<T>Map of potential diagnostics that can be emitted in this library where the key is the diagnostic code.
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.
emitter.options?publicJSONSchemaType<E>-
namereadonlystringLibrary name. MUST match package.json 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.
state?readonlyRecord<State, StateDef>Named state definitions used to create the corresponding symbols in the library’s stateKeys map.