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

[DateRangePicker] Fix DateRangePickerDayProps interface #29067

Merged
merged 4 commits into from
Dec 2, 2021

Conversation

jonathanrtuck
Copy link
Contributor

@jonathanrtuck jonathanrtuck commented Oct 15, 2021

Fix for #28373.

Problem:

  • npm build with tsc fails with a typescript throw

Solution:

  • Follow the existing pattern of other lab components (MuiDatePicker, MuiDateTimePicker, etc…) of providing unknown as a default value for TDate.

@mui-pr-bot
Copy link

mui-pr-bot commented Oct 15, 2021

No bundle size changes

Generated by 🚫 dangerJS against 92688d7

@mbrookes mbrookes added the component: date range picker This is the name of the generic UI component, not the React module! label Nov 12, 2021
@hbjORbj hbjORbj changed the title [lab] Fixed DateRangePickerDayProps interface [DateRangePicker] Fix DateRangePickerDayProps interface Dec 2, 2021
@hbjORbj hbjORbj added package: lab Specific to @mui/lab typescript labels Dec 2, 2021
Copy link
Member

@siriwatknp siriwatknp left a comment

Choose a reason for hiding this comment

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

👍

@@ -41,7 +41,8 @@ export interface DateRangePickerDayClasses {

export type DateRangePickerDayClassKey = keyof DateRangePickerDayClasses;

export interface DateRangePickerDayProps<TDate> extends Omit<PickersDayProps<TDate>, 'classes'> {
export interface DateRangePickerDayProps<TDate = unknown>
Copy link
Member

Choose a reason for hiding this comment

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

Looking at packages/mui-lab/src/themeAugmentation/props.d.ts. Shouldn't it be like this instead?

export interface LabComponentsPropsList {
  MuiAvatarGroup: AvatarGroupProps;
  MuiCalendarPicker: CalendarPickerProps<unknown>;
  MuiCalendarPickerSkeleton: CalendarPickerSkeletonProps;
  MuiClockPicker: ClockPickerProps<unknown>;
  MuiDatePicker: DatePickerProps;
  MuiDateRangePickerDay: DateRangePickerDayProps<unknown>;

Copy link
Member

Choose a reason for hiding this comment

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

If we do this MuiDateRangePickerDay: DateRangePickerDayProps<unknown>;,

do we need to set the default value here? export interface DateRangePickerDayProps<TDate = unknown>.

I think we only need either? Correct me if I am wrong.

Copy link
Member

Choose a reason for hiding this comment

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

I don't think the default type is needed.

Copy link
Member

@siriwatknp siriwatknp left a comment

Choose a reason for hiding this comment

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

Please take a look at the comment.

@hbjORbj hbjORbj requested a review from siriwatknp December 2, 2021 11:55
@siriwatknp
Copy link
Member

@jonathanrtuck Thanks for bringing this up!

Copy link
Member

@hbjORbj hbjORbj left a comment

Choose a reason for hiding this comment

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

@jonathanrtuck Thanks for your contribution!!

@hbjORbj hbjORbj merged commit bad91bd into mui:master Dec 2, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component: date range picker This is the name of the generic UI component, not the React module! package: lab Specific to @mui/lab typescript
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants