You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
import{foo}from'@foo/package';// Unused importdeclarenamespacemyAwesomeNamespace{exporttypefoo=foo;// Type alias 'foo' circularly references itself.ts(2456)}
The text was updated successfully, but these errors were encountered:
For those experiencing this issue, you can workaround it introducing some redundacy the bundler cannot detect. An example to workaround my sample code would be:
import{foo}from'@foo/package';// This type has the only purpose of introducing a redundancytypeIdentity<T>=TtypenamedFoo=Identity<foo>;namespacemyAwesomeNamespace{exporttypefoo=namedFoo;}
Thanks to the undetected redundacy, namedFoo is not removed and there will be no circular dependencies in the bundled types. It's sort of ugly, but works. Any other undetected redundancy might be use to workaround this issue.
The bundler seems to be removing type aliases that leads to circularly referenced types.
Checklist
Other plugins, such as
node-resolve
are known to cause issues..d.ts
files generated by TypeScript.The plugin can consume
.ts
and even.js
files (withallowJs: true
), but this is known to cause issues.@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
Error Message
The bundled code is the following one:
The text was updated successfully, but these errors were encountered: