-
-
Notifications
You must be signed in to change notification settings - Fork 32.5k
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
[SliderUnstyled] Define ownerState and slot props' types #32739
Conversation
@@ -237,9 +237,6 @@ const SliderUnstyled = React.forwardRef(function SliderUnstyled(props, ref) { | |||
[classes.active]: active === index, | |||
[classes.focusVisible]: focusVisible === index, | |||
})} | |||
{...(!isHostComponent(Thumb) && { |
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.
Nice catch!
ownerState: SliderUnstyledOwnerState; | ||
}; | ||
|
||
export type SliderUnstyledTrackSlotProps = UseSliderRootSlotProps & { |
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 UseSliderRootSlotProps
also contains the ref
no? Would that be a problem? Also, why would we have here this and not in the rest of the slots, for example SliderUnstyledRailSlotProps
?
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.
Too much copy-pasta. SliderUnstyledTrackSlotProps does not extend UseSliderRootSlotProps. The SliderUnstyled implementation is still JS, so TS did not catch the error.
Defined types for SliderUnstyled's
ownerState
, its slots and useSlider return type.Also renamed types and files according to #31415