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

[SliderUnstyled] Define ownerState and slot props' types #32739

Merged
merged 5 commits into from
May 25, 2022

Conversation

michaldudak
Copy link
Member

Defined types for SliderUnstyled's ownerState, its slots and useSlider return type.
Also renamed types and files according to #31415

@michaldudak michaldudak added component: slider This is the name of the generic UI component, not the React module! typescript package: base-ui Specific to @mui/base labels May 11, 2022
@michaldudak michaldudak requested a review from a team May 11, 2022 15:01
@mui-bot
Copy link

mui-bot commented May 11, 2022

Details of bundle changes

Generated by 🚫 dangerJS against da0d56d

@@ -237,9 +237,6 @@ const SliderUnstyled = React.forwardRef(function SliderUnstyled(props, ref) {
[classes.active]: active === index,
[classes.focusVisible]: focusVisible === index,
})}
{...(!isHostComponent(Thumb) && {
Copy link
Member

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 & {
Copy link
Member

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?

Copy link
Member Author

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.

@michaldudak michaldudak merged commit 67f9781 into mui:master May 25, 2022
@michaldudak michaldudak deleted the ownerstate-types/slider branch May 25, 2022 15:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component: slider This is the name of the generic UI component, not the React module! package: base-ui Specific to @mui/base typescript
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants