appsignal / appsignal-nodejs

🟩 AppSignal for Node.js
https://www.appsignal.com/nodejs/
MIT License
29 stars 9 forks source link

Look into using `api-extractor` to control exports' visibility #1131

Open unflxw opened 1 month ago

unflxw commented 1 month ago

In #1130 we use the stripInternal config option and /** @internal */ JSDoc comments to control which symbols are exported by the TypeScript compiler into .d.ts files, which in turn controls what TypeScript-enabled editors will suggest for autocompletions.

This is quite error-prone, since as @tombruijn pointed out (https://github.com/appsignal/appsignal-nodejs/pull/1130#pullrequestreview-2315583759) the compiler does not validate that the resulting set of .d.ts files is valid -- that is, some type definitions in one file might reference type definitions in another file that have been stripped out, causing the TypeScript compiler to error when handling its type definitions.

In our setup, this failure mode is mitigated somewhat by our integration tests, which attempt to compile TypeScript projects that use these definitions, failing the build if this compilation fails. Still, it might be worth looking into api-extractor, as recommended by the TypeScript documentation, which seems to be a Microsoft-backed solution for this problem space.

backlog-helper[bot] commented 1 month ago

:heavy_check_mark: All good!

New issue guide | Backlog management | Rules | Feedback