joe-bell / cva

Class Variance Authority
https://cva.style
Apache License 2.0
5.46k stars 107 forks source link

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

Closed robinclaes closed 5 months ago

robinclaes commented 5 months ago

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:

joe-bell commented 5 months ago

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

robinclaes commented 5 months ago

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 🙈.