TypeError using Preact
Closed this issue · 3 comments
jrson83 commented
When using with preact@10.16.0, I get the following TypeError:
Argument of type 'string | SignalLike<string | undefined> | undefined' is not assignable to parameter of type 'Argument'.
Type 'SignalLike<string | undefined>' is not assignable to type 'Argument'.ts(2345)
Can you possibly fix this? Or do you have a solution/workaround?
alexnault commented
Hey @jrson83! Thanks for submitting this issue.
I'll have a look. I just need your code snippet with the VSCode tooltip opened please :)
alexnault commented
I don't have experience with Preact, but from my understanding, you would need to either:
- A: compute the
className
signal to a primitive string before passing it to classix - B: change the
className
type tostring | undefined
Classix can't handle signals from Preact since it's "UI library"-agnostic. Does that make sense?
jrson83 commented
You are right! This is OK. Thanks for the response, feel free to close the issue.
// is OK
className={cx(
className as string,
uppercase && 'uppercase',
scale !== 'base' && `btn-${scale}`
)}