Can't use 'onClick' on Icon in Typescript

#80 · closed · 1 comments

View on GitHub ↗

yh54321

The `onClick` attribute can be used without issue on `<Icon />` components in JavaScript as follows: `<Icon className="helpButton" path={mdiHelpBox} onClick={() => showHelp(helpModalData)} />` However in Typescript, I get the following error: `Property 'onClick' does not exist on type 'IntrinsicAttributes & IconProps'.ts(2322)` It would appear that the intended way of resolving this is to wrap the `<Icon />` in an additional element and give the outer element the `onClick` attribute. It would be nice if `onClick` attributes could be given directly to Icon components, especially considering that there is no issue with doing so at runtime.

Comments

yh54321

I see this was addressed #36