Closed mithodin closed 1 year ago
The problem persists with version 5.3.1., I have updated my example repo: https://github.com/mithodin/dts-bundle-isolation-repro
I was trying to bulk-close all of the old issues in the repo, as I have moved the project into maintenance mode: https://github.com/Swatinem/rollup-plugin-dts/issues/277 Too bad github does not allow bulk-close-with-comment.
That being said, I will most likely not work on resolving this issue, but would very much appreciate a PR.
Solving this would likely involve changing the "post processing" code to split type-only exports from normal exports.
Checklist
node-resolve
are known to cause issues..d.ts
files generated by TypeScript. The plugin can consume.ts
and even.js
files (withallowJs: true
), but this is known to cause issues.@types
. The plugin ignores these by default, unlessrespectExternal
is set.@types
can contain hand-crafted code which is known to cause issues.Issue Description
When creating files using the tsconfig setting
isolatedModules: true
, type exports must explicitly useexport type { ... }
orexport { type ... }
(TS1205 is the relevant error code).tsc
does this correctly, e.g. the following code snippet:is reproduced as-is in the corresponding .d.ts file. However, rollup-plugin-dts elides the
type
part of the export, leading to the mentioned error. A minimal reproduction can be found here: https://github.com/mithodin/dts-bundle-isolation-repro Compile usingnpm install && npm run build
and check the file/dist/bundle.d.ts
. For comparison with tsc, runnpx tsc
and check/out/gameLibrary.d.ts
.It should be mentioned that this causes issues for anyone using a library bundled using rollup-plugin-dts, who wants to enable isolatedModules.