nextui-org/nextui

[BUG] - extendVariants TypeScript Error - Object literal may only specify known properties, and 'trigger' does not exist in type 'ClassNameArray'.ts

Opened this issue · 1 comments

NextUI Version

2.4.8

Describe the bug

I’m working on extending the Select component, and I noticed that the TypeScript error happens not only for Select but for all slot components when using extend-variants.
The error occurs when using the class property inside the object of the compoundVariants array. The error message states that 'xxx' (e.g. trigger) does not exist in type ClassNameArray.

Object literal may only specify known properties, and 'trigger' does not exist in type 'ClassNameArray'.ts(2353)
index.d.ts(20, 6): The expected type comes from property 'class' which is declared here on type 'VariantValue<{ variant: { variant1: { trigger: string[]; label: string; value: string; }; variant2: { trigger: string[]; label: string[]; value: string; }; variant3: { trigger: string[]; innerWrapper: string[]; label: string; value: string[]; }; variant4: { ...; }; ... 10 more ...; disableSelectorIconRotation: { ...'

Your Example Website or App

No response

Steps to Reproduce the Bug or Issue

  • Use extendVariants to extend the Select component.
  • Declare a new variant and use compoundVariants.
  • Inside the compoundVariants array, use the class property with any valid property defined as a key.

Expected behavior

Any valid property should be allowed in the class object.

Screenshots or Videos

Screenshot 2024-11-21 at 14 27 17

Operating System Version

macOS

Browser

Chrome