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
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.
when generating dts file, I got some weird behaviour:
This is going to break since the hash changes across versions.
The only usage of Theme type in my code is import type { Theme } from '@unocss/preset-mini' in 3 different files, I have no idea why it is bundled like this. It should not import from nested modules, instead it should import from @unocss/preset-mini straight away
One of the possible solutions I've tried is to add the following line to the index.ts file:
importtype{Theme}from'@unocss/preset-mini'
Which will end up with the correct behaviour:
I don't mean to do the same thing, but I don't want to import such type just for correcting the dts generation, where the type Theme is not used in index.ts file at all.
The above solution would be my last resort if no one could help with this (pleaseeeeee😥). It's still currently in beta so I'd prefer to wait for some proper solution.
The text was updated successfully, but these errors were encountered:
@xsjcTony You might want to report this issue to the typescript compiler instead, as if you generate typescript declarations by using tsc (enable declaration: true in tsconfig), you will see exactly the same issue in the generated declaration file:
So I assume this is the issue with TypeScript itself, not this tool or any other.
Alternatively you can specify the type of the exported variable presetAnimations explicitly export const presetAnimations: PresetFactory<Theme> = ... - this solves the issue as well but probably in a less hacky way than an unused import 😄. In theory microsoft/TypeScript#47947 might help, but the fix isn't merged yet so you can't use it haha.
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
https://github.com/xsjcTony/unocss-preset-tailwind-animate
Error Message
when generating dts file, I got some weird behaviour:
This is going to break since the hash changes across versions.
The only usage of
Theme
type in my code is import type { Theme } from '@unocss/preset-mini' in 3 different files, I have no idea why it is bundled like this.It should not import from nested modules, instead it should import from
@unocss/preset-mini
straight awayOne of the possible solutions I've tried is to add the following line to the index.ts file:
Which will end up with the correct behaviour:
I don't mean to do the same thing, but I don't want to import such type just for correcting the dts generation, where the type
Theme
is not used in index.ts file at all.The above solution would be my last resort if no one could help with this (pleaseeeeee😥). It's still currently in beta so I'd prefer to wait for some proper solution.
The text was updated successfully, but these errors were encountered: