Closed Ladvace closed 10 months ago
I think it's okay now, upgrade to the latest version.
Version 0.9.3 still has this problem,my unocss version is 0.56.0 @Dunqing
Version 0.9.3 still has this problem,my unocss version is 0.56.0 @Dunqing
Thank you for the feedback.
This is a problem caused by the inconsistency between your unocss
version and the unocss
version of unocss-preset-theme
. Normally it will only cause a type error, so you can ignore it and wait until this preset is synchronized with the latest version of unocss
to fix it.
Now you can update to 0.10.0 and the problem will be gone!
@Dunqing Hello, this issue has resurfaced in version 0.11.0, and my unocss version is 0.57.3.
Can the following types of changes be made?
interface PresetThemeOptions<Theme extends Record<string, any>> {
theme: Record<string, Theme>
}
// changed to blow
interface Colors {
[key: string]: Colors & {
DEFAULT?: string;
} | string;
}
interface PresetThemeOptions<Theme extends Record<string, any>> {
theme: Record<string, { colors: Colors }>
// or Record<string, Colors>
}
Colors type from https://github.com/unocss/unocss/blob/af91b66e141794489e49bffd521d989dd8b76888/packages/preset-mini/src/_theme/types.ts#L11-L13
Remove all other configuration options and keep only colors
. Users can use dark:xxx
in their business code for condition checking. This plugin should only handle color-related logic.
I have the following config but I get this error:
Type 'Preset<Theme>' is not assignable to type 'Preset<any> | Preset<any>[]'. Type 'Preset<Theme>' is not assignable to type 'Preset<any>'. Types of property 'rules' are incompatible. Type 'Rule<Theme>[] | undefined' is not assignable to type 'Rule<any>[] | undefined'. Type 'Rule<Theme>[]' is not assignable to type 'Rule<any>[]'. Type 'Rule<Theme>' is not assignable to type 'Rule<any>'. Type '[RegExp, DynamicMatcher<Theme>]' is not assignable to type 'Rule<any>'. Type '[RegExp, DynamicMatcher<Theme>]' is not assignable to type '[string, CSSObject | CSSEntries] | [RegExp, DynamicMatcher<any>]'. Type '[RegExp, DynamicMatcher<Theme>]' is not assignable to type '[string, CSSObject | CSSEntries]'. Type at position 0 in source is not compatible with type at position 0 in target. Type 'RegExp' is not assignable to type 'string'.ts(2322)