Skip to content

Bundle introduces a type that references to itself #325

@notaphplover

Description

@notaphplover

The bundler seems to be removing type aliases that leads to circularly referenced types.

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

import { foo as namedFoo } from '@foo/package';

namespace myAwesomeNamespace {
  export type foo = namedFoo;
}

Error Message

The bundled code is the following one:

import { foo } from '@foo/package'; // Unused import

declare namespace myAwesomeNamespace {
  export type foo = foo; // Type alias 'foo' circularly references itself.ts(2456)
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions