Closed conduongtong closed 1 week ago
2.4.6
I cannot use variant type string[] with extendVariants like code below:
'use client'; import { Button as BaseButton, extendVariants } from '@nextui-org/react'; const Button = extendVariants(BaseButton, { // Must define default variants before extending them defaultVariants: { size: 'md', variant: 'solid', color: 'default' }, compoundVariants: [ { variant: ['solid'], // <-- ERROR: Type 'string[]' is not assignable to type '"solid" | "bordered" | "light" | "flat" | "faded" | "shadow" | "ghost" | undefined'. color: 'default', class: 'text-white' } ], variants: { size: { sm: 'text-button-sm leading-button-sm h-fit rounded-sm px-14 py-6', md: 'text-button-md leading-button-md h-fit rounded-md px-20 py-8', lg: 'text-button-lg leading-button-lg h-fit rounded-lg px-26 py-11' } } }); export default Button;
But if I as any, it still works. Is this expected behavior?
No response
Just put the code and see typescript error
No typerscript error
Windows
Chrome
ENG-1186 [BUG] - Typescript, extendVariants not allowed variant array
NextUI Version
2.4.6
Describe the bug
I cannot use variant type string[] with extendVariants like code below:
But if I as any, it still works. Is this expected behavior?
Your Example Website or App
No response
Steps to Reproduce the Bug or Issue
Just put the code and see typescript error
Expected behavior
No typerscript error
Screenshots or Videos
No response
Operating System Version
Windows
Browser
Chrome