Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[bug] Introduces a variable that cirtularly references itself #307

Open
3 tasks done
nicolo-ribaudo opened this issue May 8, 2024 · 0 comments
Open
3 tasks done

Comments

@nicolo-ribaudo
Copy link

nicolo-ribaudo commented May 8, 2024

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

// index.d.ts
declare namespace a {
  var fn: typeof import("./other-file.d.ts").fn;
}

export { a };
// other-file.d.ts
export declare function fn(): void;

The .ts files are

// index.ts
import { fn } from "./other-file";
export function a() {}
a.fn = fn;
// other-file.ts
export function fn() {}

Output

declare function fn(): void;

declare function a(): void;
declare namespace a {
    var fn: typeof fn;
}

export { a };

You can see that var fn circularly references itself, rather than referencing the fn function.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant