cva icon indicating copy to clipboard operation
cva copied to clipboard

cx error Argument of type 'false' is not assignable to parameter of type 'ClassValue'

Open robinclaes opened this issue 1 year ago • 1 comments

Describe the bug When using cx with false values, Typescript complains that false is not assignable to 'ClassValue'.

To Reproduce Steps to reproduce the behavior:

className={cx(
    'absolute top-1/2 -translate-y-1/2 right-4 text-gray-500',
    hasError && 'text-red-400'
)}

Expected behavior I expect no typescript error, as the underlying library clsx can handle false as a value.

Software used:

  • Visual Studio Code 1.85.1 (MacOS)
  • Typescript 5.3.2

robinclaes avatar Jan 16 '24 13:01 robinclaes

Unable to recreate this – I'm using false in many projects with no issues. Please provide a working reproduction

joe-bell avatar Jan 17 '24 07:01 joe-bell

We were still using an older version of the package. After updating from 0.4.0 to 0.7.0 this issue was resolved. Sorry for the inconvenience 🙈.

robinclaes avatar Jan 25 '24 09:01 robinclaes