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

[pickers] Fix regression on PickerValidDate #14896

Merged
merged 2 commits into from
Oct 9, 2024

Conversation

flaviendelangle
Copy link
Member

@flaviendelangle flaviendelangle commented Oct 9, 2024

Fix #14895

@flaviendelangle flaviendelangle changed the title [pickers] Fix regression on `PickerValidDate [pickers] Fix regression on PickerValidDate Oct 9, 2024
@flaviendelangle flaviendelangle self-assigned this Oct 9, 2024
@flaviendelangle flaviendelangle added typescript regression A bug, but worse component: pickers This is the name of the generic UI component, not the React module! labels Oct 9, 2024
@mui-bot
Copy link

mui-bot commented Oct 9, 2024

Deploy preview: https://deploy-preview-14896--material-ui-x.netlify.app/

Generated by 🚫 dangerJS against 0c6c7b8

@@ -112,6 +112,10 @@ const DateTimeRangePickerToolbarEnd = styled(DateTimePickerToolbar, {
],
}) as DateTimeRangePickerStartOrEndToolbarComponent;

type DateTimeRangePickerToolbarComponent = (<TDate extends PickerValidDate>(
Copy link
Member Author

Choose a reason for hiding this comment

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

I don't understand why, but without it the type gets inline in the bundle and we end up with the following:

image

Copy link
Member

Choose a reason for hiding this comment

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

🤷🏼

@flaviendelangle flaviendelangle marked this pull request as ready for review October 9, 2024 12:38
Copy link
Member

@michelengelen michelengelen left a comment

Choose a reason for hiding this comment

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

Seems good to me

@@ -112,6 +112,10 @@ const DateTimeRangePickerToolbarEnd = styled(DateTimePickerToolbar, {
],
}) as DateTimeRangePickerStartOrEndToolbarComponent;

type DateTimeRangePickerToolbarComponent = (<TDate extends PickerValidDate>(
Copy link
Member

Choose a reason for hiding this comment

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

🤷🏼

Copy link
Member

@LukasTy LukasTy left a comment

Choose a reason for hiding this comment

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

LGTM. 👍
Other cases would result in the same output if the as casting is removed. 🙈
I.e. DatePickerToolbar.
Ideally—it would be nice to automate the avoidance of such output. 😆

@flaviendelangle
Copy link
Member Author

Ideally—it would be nice to automate the avoidance of such output.

A dirty solution would be to look automatically for import('lodash') and equivalent in the build (outside of the adapters)

@LukasTy
Copy link
Member

LukasTy commented Oct 9, 2024

A dirty solution would be to look automatically for import('lodash') and equivalent in the build (outside of the adapters)

Yeah, my only idea as well. 🤔
But, I'd say that we could leave this effort for when and if we encounter the same problem. 👍 🙈

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component: pickers This is the name of the generic UI component, not the React module! regression A bug, but worse typescript
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[pickers] Cannot compile in TypeScript with skipLibCheck: false
4 participants