If you ship a TypeScript library, your .d.ts is part of the public API. But the existing bundlers (rollup-plugin-dts, rolldown-plugin-dts, dts-bundle-generator) all get it subtly wrong in different ways — garbled type names, types dropped behind re-exports, etc. Enough libraries have hit this that some (Rollup included) just hand-write their declaration file.
@microsoft/api-extractor handles all of it correctly, but it's CLI-only with a fairly involved config, which is awkward if the rest of your build is already in Rollup. So I put together a small plugin that runs it from inside a normal Rollup config. Curious if it holds up on weirder setups.
If you ship a TypeScript library, your .d.ts is part of the public API. But the existing bundlers (rollup-plugin-dts, rolldown-plugin-dts, dts-bundle-generator) all get it subtly wrong in different ways — garbled type names, types dropped behind re-exports, etc. Enough libraries have hit this that some (Rollup included) just hand-write their declaration file.
@microsoft/api-extractor handles all of it correctly, but it's CLI-only with a fairly involved config, which is awkward if the rest of your build is already in Rollup. So I put together a small plugin that runs it from inside a normal Rollup config. Curious if it holds up on weirder setups.