-
-
Notifications
You must be signed in to change notification settings - Fork 75
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
[core] Fix render prop types #1213
Conversation
Netlify deploy preview |
@@ -46,14 +46,18 @@ namespace TooltipTrigger { | |||
open: boolean; | |||
} | |||
|
|||
export interface Props extends BaseUIComponentProps<any, State> {} | |||
export interface Props extends BaseUIComponentProps<'div', State> {} |
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.
Do we expect here people to always need to cast if they use different element?
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.
The render
prop's props
parameter is actually loosely typed in order to allow you to compose different tags.
We need to ensure we document when a tag can't be replaced if we aren't polyfilling native behavior (e.g. if it relies in a specific tag's native props in order to work, like <button>
being replaced with a <span>
, but internally is not using useButton()
to keep it accessible).
We could actually remove the first tag
type since it serves no purpose in this case
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.
Let's see if this will be enough, if we see more issues around this we can revisit it.
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.
Can we add types test please? We could add TooltipTrigger.spec.ts
file with different use-cases.
Continues #1209
Switches to
GenericHTMLProps
for therender
props type. This includes theref
which was previously missing. Using'div'
for Tooltip uses theGenericHTMLProps
regardless.