nextui-org / tailwind-variants

🦄 Tailwindcss first-class variant API
https://tailwind-variants.org
MIT License
2.42k stars 70 forks source link

Type error when TailwindVariant style contains boolean #105

Closed maracht-nn closed 1 year ago

maracht-nn commented 1 year ago

Describe the bug Receive type error when TailwindVariant style contains boolean.

To Reproduce Steps to reproduce the behavior:

  1. Have boolean in the tv style
  2. Use tv style in .tsx file
  3. See type error saying Type boolean is not assignable to string | number | undefined

Expected behavior There should not be any errors. The boolean should be converted to string under the hood. Or the type should accept boolean.

Screenshots

The setting on tv containing booleans: image

The type error received when using the tv style: image

Desktop (please complete the following information):

Smartphone (please complete the following information):

Additional context Please let me know if there is any questions. Thank you.

mskelton commented 1 year ago

I'm not able to reproduce this, please try upgrading to the latest version or provide a code sandbox link that reproduces the error.

maracht-nn commented 1 year ago

My bad, I found the issue on my side. I was trying to abstract the function and missed passing the correct type. After using {TV} from 'tailwind-variants', everything's working perfectly.

Sorry for the oversight, and thanks for your patience! 🙏