Skip to content

[pickers] Fix regression on PickerValidDate#14896

Merged
flaviendelangle merged 2 commits intomui:masterfrom
flaviendelangle:typo-picker-valid-date
Oct 9, 2024
Merged

[pickers] Fix regression on PickerValidDate#14896
flaviendelangle merged 2 commits intomui:masterfrom
flaviendelangle:typo-picker-valid-date

Conversation

@flaviendelangle
Copy link
Copy Markdown
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 type: regression A bug, but worse, it used to behave as expected. scope: pickers Changes related to the date/time pickers. labels Oct 9, 2024
@mui-bot
Copy link
Copy Markdown

mui-bot commented Oct 9, 2024

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

Generated by 🚫 dangerJS against 0c6c7b8

],
}) as DateTimeRangePickerStartOrEndToolbarComponent;

type DateTimeRangePickerToolbarComponent = (<TDate extends PickerValidDate>(
Copy link
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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

],
}) as DateTimeRangePickerStartOrEndToolbarComponent;

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

Choose a reason for hiding this comment

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

🤷🏼

Copy link
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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

scope: pickers Changes related to the date/time pickers. type: regression A bug, but worse, it used to behave as expected. typescript

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[pickers] Cannot compile in TypeScript with skipLibCheck: false

4 participants