Support libraries using auto decorators in tspd - #11813
Support libraries using auto decorators in tspd#11813Timothee Guerin (timotheeguerin) wants to merge 2 commits into
Conversation
commit: |
|
All changed packages have been documented.
Show changes
|
Load the config file when compiling a library for signature generation and reference docs, so features it opts into (such as auto-decorators) apply.
Use the decorator's own description so libraries re-exporting the accessors satisfy api-extractor.
2b72c8c to
d989d8b
Compare
|
You can try these changes here
|
Two things stand in the way of a library shipping
auto decin its public API.tspd never loads the library's own
tspconfig.yaml. Everycompile()call site passes onlyparseOptions, so any compiler feature the library opts into is invisible.@typespec/graphqlshowsthe symptom today — its
regen-docsprints one error per auto decorator:Fixed by running the library's entrypoint through the existing
resolveCompilerOptionsand handingthe result to
compile(), withnoEmit: truesince tspd only ever inspects a library.Generated accessors carried no doc comment, so a library re-exporting one failed api-extractor's
ae-undocumentedrule. They now inherit the description of the decorator they read or write, whichis already the source of truth in the
.tsp:Only the description is carried over; the decorator's
@paramtags describe its TypeSpec parameters,which do not line up with the accessor signatures. A decorator with no doc still generates no doc.
One detail worth knowing for anyone touching this later: the doc is emitted as a standalone comment
rather than through alloy's
docprop, because that prop also emits@param {Type}tags whose typereferences count as value usages — which turns this file's type-only imports into value imports and
breaks
verbatimModuleSyntax.The only output change is
@typespec/graphql's regenerated signatures.