rollup-plugin-dts icon indicating copy to clipboard operation
rollup-plugin-dts copied to clipboard

type only exports of classes are not respected

Open brc-dd opened this issue 9 months ago • 0 comments

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 (with allowJs: true), but this is known to cause issues.
  • [x] This issue is not related to rolling up @types. The plugin ignores these by default, unless respectExternal 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 };

brc-dd avatar Jun 04 '24 06:06 brc-dd