Replies: 1 comment
-
Hey @tordans! 👋 Thanks for your feedback! I'd love to build a codemod to help migrating from clsx but I'm maintaining this package alone next to my full time job, so this probably won't happen unfortunately, unless someone else wants to build it. tailwind-merge doesn't support the object syntax. I wrote here about why it isn't supported: #137 (comment) I'd suggest to keep using clsx({ 'hover:text-blue-500': menuHighlight !== 'posts' }, 'text-black')
// becomes
twJoin(menuHighlight !== 'posts' && 'hover:text-blue-500', 'text-black') You can also check out the example used here: https://github.com/dcastil/tailwind-merge/blob/v1.13.2/docs/when-and-how-to-use-it.md#joining-internal-classes |
Beta Was this translation helpful? Give feedback.
-
I was hoping I could search and replace all
clsx
calls withtwJoin
to migrate my projects.However, I am getting type errors for the object syntax that clsx supports:
… results in Error:
Ideally …
twJoin
andclsx
would allow the same inputWhat is the current, recommended way to migrate? Globally replace the imports and names and then check the TS errors by hand?
Beta Was this translation helpful? Give feedback.
All reactions