-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
Building Strongly Typed Polymorphic Components #18274
base: main
Are you sure you want to change the base?
Conversation
✅ Deploy Preview for carbon-elements ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
✅ Deploy Preview for v11-carbon-web-components ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
✅ Deploy Preview for v11-carbon-react ready!Built without sensitive environment variables
To edit notification comments on pull requests, go to your Netlify site configuration. |
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #18274 +/- ##
=======================================
Coverage 84.31% 84.31%
=======================================
Files 404 404
Lines 14359 14359
Branches 4656 4660 +4
=======================================
Hits 12107 12107
+ Misses 2090 2089 -1
- Partials 162 163 +1 ☔ View full report in Codecov by Sentry. |
@@ -11,7 +11,7 @@ import classnames from 'classnames'; | |||
import { usePrefix } from '../../internal/usePrefix'; | |||
import { Text } from '../Text'; | |||
|
|||
type ListItemProps = ComponentProps<'li'>; | |||
type ListItemProps = Omit<ComponentProps<'li'>, 'ref'>; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added this fix because of this typescript error:
Types of property 'ref' are incompatible.
This removes the ref property from ComponentProps<'li'>
, preventing conflicts with the Text component.
Closes #18279
Implemented a strong type PolymorphicProps to be reusable to other components.
Text
component is using the newPolymorphicComponentPropWithRef
Here it is an example:
Changelog
New
Changed
Text
to use newPolymorphicComponentPropWithRef
Testing / Reviewing