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

Fix incorrect TypeScript type for custom components passed to EuiIcon #3252

Merged

Conversation

chandlerprall
Copy link
Contributor

@chandlerprall chandlerprall commented Apr 3, 2020

Summary

Fixes #3175

EuiIcon incorrectly specified ReactElement instead of ComponentType, this passed through TS because the svg imports are typed as any, mixing in that type at const icon = this.state.icon || empty; and losing any subsequent type checking.

  • fixed the type
  • added proper type casting on empty to avoid mixing in any
  • added unit test

Checklist

- [ ] Check against all themes for compatibility in both light and dark modes
- [ ] Checked in mobile
- [ ] Checked in IE11 and Firefox

  • Props have proper autodocs
    - [ ] Added documentation examples
  • Added or updated jest tests
  • Checked for breaking changes and labeled appropriately
    - [ ] Checked for accessibility including keyboard-only and screenreader modes
  • A changelog entry exists and is marked appropriately

@chandlerprall chandlerprall requested a review from thompsongl April 3, 2020 20:33
@kibanamachine
Copy link

Preview documentation changes for this PR: https://eui.elastic.co/pr_3252/

Copy link
Contributor

@thompsongl thompsongl left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🙏

@chandlerprall chandlerprall merged commit 0fc7625 into elastic:master Apr 4, 2020
@chandlerprall chandlerprall deleted the bug/3175-euiicon-component-type branch April 4, 2020 03:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

iconType: Invalid prop warning in when a function is used as prop to render custom icon
4 participants