Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

React type export doesn't include title #810

Closed
jharwig opened this issue Sep 12, 2022 · 1 comment · Fixed by #814
Closed

React type export doesn't include title #810

jharwig opened this issue Sep 12, 2022 · 1 comment · Fixed by #814
Assignees

Comments

@jharwig
Copy link

jharwig commented Sep 12, 2022

Since #779, the title prop can be set to create an svg title element, but the react typings do not include that prop: since the the definition in the Icon.d.ts file doesn't include it:

declare function StarIcon(props: React.ComponentProps<'svg'>): JSX.Element;

The error message is Property 'title' does not exist on type 'IntrinsicAttributes & SVGProps<SVGSVGElement>'.

I think the vue types are working because it allows any HTMLAttributes through, so it's probably just a matter of adding a & {title?: string } to the react props...

-? `import * as React from 'react';\ndeclare function ${componentName}(props: React.ComponentProps<'svg'>): JSX.Element;\nexport default ${componentName};\n`
+? `import * as React from 'react';\ndeclare function ${componentName}(props: React.ComponentProps<'svg'> & {title?: string}): JSX.Element;\nexport default ${componentName};\n`
@RobinMalfait
Copy link
Contributor

Hey! Thank you for your PR!
Much appreciated! 🙏

This should be fixed by #814, and will be available in the next release.

You can already try it using:

  • npm install @heroicons/react@insiders.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants