[Bug]: Tab renderIcon typescript error when passing Carbon Icon #16735
Labels
area: typescript
component: tabs
role: dev 🤖
severity: 3
https://ibm.biz/carbon-severity
type: bug 🐛
Package
@carbon/react
Browser
Chrome
Package version
v1.59.0
React version
v18.2.0
Description
Using the
<Tab />
Component alongside therenderIcon
property and passing an icon (in my case passing DataTable) from@carbon/react/icons
displays a Typescript error:This is due to the type of
renderIcon
beingComponentType<{size: number}>
. From my understanding and researching, ComponentType is used for when the component is either a Class or a Function. And looking into theCarbonIconType
, this is anSVGElement
?I'm following the examples of the Tabs with Icons:
My code:
I modified the
Tabs.d.ts
file and changed the typeElementType
similar to what theButton
component does for its'renderIcon
and this worked.Reproduction/example
https://stackblitz.com/edit/github-mbuhin?file=src%2FApp.tsx
Steps to reproduce
Tab
component from Carbon.renderIcon
property ofTab
Suggested Severity
None
Application/PAL
No response
Code of Conduct
The text was updated successfully, but these errors were encountered: