javascripttypescriptshared-librariesrollup

How can rollup plugins generate its .d.ts types with .js file


As title, how can rollup plugins generate its .d.ts types with .js file without jsdoc.

for example, I can't find jsdoc and .ts file in rollup-plugin-commonjs (https://github.com/rollup/plugins/tree/master/packages/commonjs), but this package has its .d.ts declaration.

rollup-plugin-commonjs


Solution

  • .d.ts files don't need to be automatically generated from JSDoc or .ts files, they can be manually written.

    It looks like the authors of this plugin decided to write the .d.ts file themselves and use vanilla JS for the actual code.