Plugins: Generating d.ts files in TypeScript projects

Created on 13 May 2020  路  7Comments  路  Source: rollup/plugins

  • Rollup Plugin Name: typescript
  • Rollup Plugin Version: 4.1.1

Documentation Is:

  • [x] Missing
  • [x] Needed
  • [ ] Confusing
  • [ ] Not Sure?

Please Explain in Detail...

It isn't clear to me how to get the typescript plugin to generate d.ts files in the output. I've tried adding { declaration: true, declarationDir: 'dist' } to the plugin config and output.dir to the Rollup config, but it just fails silently without creating any d.ts files.

I made a branch here with my progress so far: https://github.com/ReactTraining/react-router/tree/dev-rollup-ts

Your Proposal for Changes

I'd like to see a clear example in the typescript plugin's README file about how to generate d.ts files in the output.

s鹿 馃敟馃敟馃敟 critical t虏 馃摎 documentation 馃攲 plugin-typescript

Most helpful comment

@egoist I'm currently using rollup-plugin-typescript2 to generate my d.ts files, so I've already got something working. This issue is more about getting support for generating d.ts files in the official plugin for typescript.

All 7 comments

big problem here

@leecade that's why we labeled it critical. please refrain from posting _"me too"_ type replies. It only adds extra noise.

Maybe give https://github.com/Swatinem/rollup-plugin-dts a try? It also bundles your d.ts files

@egoist I'm currently using rollup-plugin-typescript2 to generate my d.ts files, so I've already got something working. This issue is more about getting support for generating d.ts files in the official plugin for typescript.

Any updates on the progress on this issue? I have some time free and would like this fixed, is there any way I can help? @shellscape @NotWoods

If it helps declaration files seem to work just fine when using outDir, but fail silently when using declarationDir.

I tried to add rootDir field in typescript plugin config and it works

Was this page helpful?
0 / 5 - 0 ratings