-
-
Notifications
You must be signed in to change notification settings - Fork 965
Closed
Description
UnoCSS version
66.6.0
Describe the bug
When using Attributify mode, print:hidden works at runtime but TypeScript reports property missing:
不能将类型“{ "print:hidden": true; }”分配给类型“HTMLAttributes”。
类型“HTMLAttributes”上不存在属性“print:hidden”。ts(2322)
I'm sure it is a bug, because print:block-0 doesn't trigger the error, while print:hidden and print:block do.
My workaround:
// shims.d.ts
import type { AttributifyAttributes } from '@unocss/preset-attributify';
type VariantPrefixes = 'print';
type UtilityNames = 'hidden' | 'block';
type Variants = {
[K in VariantPrefixes | `${VariantPrefixes}:${UtilityNames}`]?: boolean | string;
};
declare global {
namespace astroHTML.JSX {
interface HTMLAttributes extends AttributifyAttributes, Variants { }
}
}Reproduction
<header print:hidden></header>// shims.d.ts
import type { AttributifyAttributes } from '@unocss/preset-attributify'
declare global {
namespace astroHTML.JSX {
interface HTMLAttributes extends AttributifyAttributes { }
}
}System Info
OS: macOS Sequoia 15.5 arm64
Astro: 5.17.1
Validations
- Read the Contributing Guidelines.
- Check that there isn't already an issue that reports the same bug to avoid creating a duplicate.
- Check that this is a concrete bug. For Q&A open a GitHub Discussion or join our Discord Chat Server.
- The provided reproduction is a minimal reproducible example of the bug.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels