rollup-plugin-dts
rollup-plugin-dts copied to clipboard
type only exports of classes are not respected
Checklist
- [x] I can reproduce this issue when running this plugin on its own.
Other plugins, such as
node-resolve
are known to cause issues. - [x] I am running this plugin on
.d.ts
files generated by TypeScript. The plugin can consume.ts
and even.js
files (withallowJs: true
), but this is known to cause issues. - [x] This issue is not related to rolling up
@types
. The plugin ignores these by default, unlessrespectExternal
is set.@types
can contain hand-crafted code which is known to cause issues.
Code Snippet
declare class Foo {
bar: string;
}
export type { Foo };
Actual Output
declare class Foo {
bar: string;
}
export { Foo };
Expected Output
declare class Foo {
bar: string;
}
export type { Foo };
Additional Context
It works if I alias my class as a type instead:
declare class _Foo {
bar: string;
}
type Foo = _Foo;
export type { Foo };
Output
declare class _Foo {
bar: string;
}
type Foo = _Foo;
export type { Foo };