Replies: 1 comment 1 reply
-
Another TS error happening with CheckboxGroup. Given this component: import { CheckboxGroup, extendVariants } from "@nextui-org/react";
export const CustomCheckboxGroup = extendVariants(CheckboxGroup, {
variants: {
color: {
"secondary-light": {
wrapper: "bg-secondary-800 p-4 gap-4",
label: "text-secondary-600",
},
},
},
compoundVariants: [{ className: { wrapper: "rounded" } }],
}); I receive the following error: src/custom/CustomCheckboxGroup.tsx:12:24 - error TS2322: Type '{ wrapper: string; }' is not assignable to type 'string | (string & ClassNameArray) | undefined'.
Type '{ wrapper: string; }' is not assignable to type 'undefined'.
12 compoundVariants: [{ className: { wrapper: "rounded" } }],
~~~~~~~~~
node_modules/tailwind-variants/dist/index.d.ts:20:21
20 | {class?: never; className?: never};
~~~~~~~~~
The expected type comes from property 'className' which is declared here on type 'VariantValue<{ color: { "secondary-light": { wrapper: string; label: string; }; }; }, SuggestedVariants<MergeWithAs<Omit<DetailedHTMLProps<HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref">, Omit<...>, CheckboxGroupProps, As<...>>, SlotsToClasses<...>>> & ClassProp<...>' Although the className is applied correctly to the component |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hello!
I want to add new compound variants, but I get a typescript error.
Beta Was this translation helpful? Give feedback.
All reactions