Swatinem/rollup-plugin-dts

Namespaced type is exported as "export type" instead of just "export"

hazae41 opened this issue · 3 comments

Checklist

  • I can reproduce this issue when running this plugin on its own.
    Other plugins, such as node-resolve are known to cause issues.
  • 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.
  • 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 Snipped

export interface MyInterface {
  // stuff
}

export namespace MyInterface {
  // stuff
}

Produced Result

In 6.0.0 the output is this

interface MyInterface {
  // stuff
}
declare namespace MyInterface {
  // stuff
}

export type { MyInterface };

When used in other projects, this error is thrown:

'MyInterface' cannot be used as a value because it was exported using 'export type'.

Expected Result

In 5.3.0 the result is this

interface MyInterface {
  // stuff
}
declare namespace MyInterface {
  // stuff
}

export { MyInterface };

The bug was added in 1b228d0

Interesting, I thought I had accounted for that kind of situation. Shouldn't be too hard to fix though.