Closed jschuur closed 1 week ago
Hi @jschuur has this issue been resolved with v3.14
?
Hi @severinlandolt, I can confirm it is React.JSXElementConstructor<any>
in v3.14.0
Types of property 'icon' are incompatible.
Type 'Element' is not assignable to type 'JSXElementConstructor<any> | undefined'
// It's happy with this
✅ icon: Star
✅ icon: () => <Star />
// But not this:
❌ icon: <Star />
I'm assuming that it doesn't accept icon: <Star />
since it wants to apply CSS classes.
Hey there! This is a use-case I haven't thought of. Thanks @BenJenkinson for investigating. Since we apply our own className, I am not keen on changing this logic at the moment.
However: We recently launched Tremor Raw, a copy & paste library for React components. Here we have a new version of the BarList, where you have full control over this :)
Hi @severinlandolt & @jschuur,
My apologies, but I just realised that I misread @jschuur's question.
He wasn't asking about the icon
, but the name
property.
The name
property is rendered as children, so it could easily be typed as a name: ReactNode
instead.
It's currently typed as name: string
The only thing that would need to change is the two places where the name
is used as a fallback for the key
prop; can't do that if it is a ReactNode
Just published an overhauled version of the BarList, happy to review a PR for this :)
:tada: This issue has been resolved in version 3.17.0 :tada:
The release is available on:
Your semantic-release bot :package::rocket:
Tremor Version
3.13.4
Link to minimal reproduction
n/a
Steps to reproduce
I'm setting the
name
property of the data array passed into aBarList
to a JSX Element and this renders fine, but I get a TypeScript error because the type fordata
doesn't allow for Elements.What is expected?
Should not show TypeScript error if it can render JSX Elements in the data.
What is actually happening?
TypeScript error.