From 0dd7e8c20492d17f163769f231a616d603edcfe5 Mon Sep 17 00:00:00 2001 From: mertJF Date: Tue, 12 Nov 2024 17:17:43 +0300 Subject: [PATCH 1/2] fix(types): `PropsWithChildren` type argument issue --- src/calendar.tsx | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/calendar.tsx b/src/calendar.tsx index b598b0fd4..93dcac665 100644 --- a/src/calendar.tsx +++ b/src/calendar.tsx @@ -103,7 +103,7 @@ export interface ReactDatePickerCustomHeaderProps { nextYearButtonDisabled: boolean; } -type CalendarProps = React.PropsWithChildren & +type CalendarProps = React.PropsWithChildren< Omit< YearDropdownProps, "date" | "onChange" | "year" | "minDate" | "maxDate" @@ -205,7 +205,8 @@ type CalendarProps = React.PropsWithChildren & } & Pick & Pick & Pick) - ); + ) +> interface CalendarState extends Pick, From 066da4f790ab3b2c42f4750d113b16977ede464d Mon Sep 17 00:00:00 2001 From: mertJF Date: Wed, 13 Nov 2024 16:36:09 +0300 Subject: [PATCH 2/2] fix(types): lint --- src/calendar.tsx | 198 +++++++++++++++++++++++------------------------ 1 file changed, 99 insertions(+), 99 deletions(-) diff --git a/src/calendar.tsx b/src/calendar.tsx index 93dcac665..69efadd32 100644 --- a/src/calendar.tsx +++ b/src/calendar.tsx @@ -108,105 +108,105 @@ type CalendarProps = React.PropsWithChildren< YearDropdownProps, "date" | "onChange" | "year" | "minDate" | "maxDate" > & - Omit & - Omit & - Omit< - YearProps, - | "onDayClick" - | "selectingDate" - | "clearSelectingDate" - | "onYearMouseEnter" - | "onYearMouseLeave" - | "minDate" - | "maxDate" - > & - Omit< - MonthProps, - | "ariaLabelPrefix" - | "onChange" - | "day" - | "onDayClick" - | "handleOnKeyDown" - | "handleOnMonthKeyDown" - | "onDayMouseEnter" - | "onMouseLeave" - | "orderInDisplay" - | "monthShowsDuplicateDaysEnd" - | "monthShowsDuplicateDaysStart" - | "minDate" - | "maxDate" - > & - Omit & - Omit & { - className?: string; - container?: React.ElementType; - showYearPicker?: boolean; - showMonthYearPicker?: boolean; - showQuarterYearPicker?: boolean; - showTimeSelect?: boolean; - showTimeInput?: boolean; - showYearDropdown?: boolean; - showMonthDropdown?: boolean; - yearItemNumber?: number; - useWeekdaysShort?: boolean; - forceShowMonthNavigation?: boolean; - showDisabledMonthNavigation?: boolean; - formatWeekDay?: (date: string) => string; - onDropdownFocus?: (event: React.FocusEvent) => void; - calendarStartDay?: Day; - weekDayClassName?: (date: Date) => string; - onMonthChange?: (date: Date) => void; - onYearChange?: (date: Date) => void; - onDayMouseEnter?: (date: Date) => void; - onMonthMouseLeave?: VoidFunction; - weekLabel?: string; - onClickOutside: ClickOutsideHandler; - outsideClickIgnoreClass?: string; - previousMonthButtonLabel?: React.ReactNode; - previousYearButtonLabel?: string; - previousMonthAriaLabel?: string; - previousYearAriaLabel?: string; - nextMonthButtonLabel?: React.ReactNode; - nextYearButtonLabel?: string; - nextMonthAriaLabel?: string; - nextYearAriaLabel?: string; - showPreviousMonths?: boolean; - monthsShown?: number; - monthSelectedIn?: number; - onSelect: ( - day: Date, - event?: - | React.MouseEvent - | React.KeyboardEvent, - monthSelectedIn?: number, - ) => void; - renderCustomHeader?: ( - props: ReactDatePickerCustomHeaderProps, - ) => JSX.Element; - onYearMouseEnter?: YearProps["onYearMouseEnter"]; - onYearMouseLeave?: YearProps["onYearMouseLeave"]; - monthAriaLabelPrefix?: MonthProps["ariaLabelPrefix"]; - handleOnDayKeyDown?: MonthProps["handleOnKeyDown"]; - handleOnKeyDown?: ( - event: - | React.KeyboardEvent - | React.KeyboardEvent - | React.KeyboardEvent, - ) => void; - onTimeChange?: TimeProps["onChange"] | InputTimeProps["onChange"]; - timeFormat?: TimeProps["format"]; - timeIntervals?: TimeProps["intervals"]; - } & ( - | ({ - showMonthYearDropdown: true; - } & Pick) - | ({ - showMonthYearDropdown?: never; - } & Pick & - Pick & - Pick) - ) -> + Omit & + Omit & + Omit< + YearProps, + | "onDayClick" + | "selectingDate" + | "clearSelectingDate" + | "onYearMouseEnter" + | "onYearMouseLeave" + | "minDate" + | "maxDate" + > & + Omit< + MonthProps, + | "ariaLabelPrefix" + | "onChange" + | "day" + | "onDayClick" + | "handleOnKeyDown" + | "handleOnMonthKeyDown" + | "onDayMouseEnter" + | "onMouseLeave" + | "orderInDisplay" + | "monthShowsDuplicateDaysEnd" + | "monthShowsDuplicateDaysStart" + | "minDate" + | "maxDate" + > & + Omit & + Omit & { + className?: string; + container?: React.ElementType; + showYearPicker?: boolean; + showMonthYearPicker?: boolean; + showQuarterYearPicker?: boolean; + showTimeSelect?: boolean; + showTimeInput?: boolean; + showYearDropdown?: boolean; + showMonthDropdown?: boolean; + yearItemNumber?: number; + useWeekdaysShort?: boolean; + forceShowMonthNavigation?: boolean; + showDisabledMonthNavigation?: boolean; + formatWeekDay?: (date: string) => string; + onDropdownFocus?: (event: React.FocusEvent) => void; + calendarStartDay?: Day; + weekDayClassName?: (date: Date) => string; + onMonthChange?: (date: Date) => void; + onYearChange?: (date: Date) => void; + onDayMouseEnter?: (date: Date) => void; + onMonthMouseLeave?: VoidFunction; + weekLabel?: string; + onClickOutside: ClickOutsideHandler; + outsideClickIgnoreClass?: string; + previousMonthButtonLabel?: React.ReactNode; + previousYearButtonLabel?: string; + previousMonthAriaLabel?: string; + previousYearAriaLabel?: string; + nextMonthButtonLabel?: React.ReactNode; + nextYearButtonLabel?: string; + nextMonthAriaLabel?: string; + nextYearAriaLabel?: string; + showPreviousMonths?: boolean; + monthsShown?: number; + monthSelectedIn?: number; + onSelect: ( + day: Date, + event?: + | React.MouseEvent + | React.KeyboardEvent, + monthSelectedIn?: number, + ) => void; + renderCustomHeader?: ( + props: ReactDatePickerCustomHeaderProps, + ) => JSX.Element; + onYearMouseEnter?: YearProps["onYearMouseEnter"]; + onYearMouseLeave?: YearProps["onYearMouseLeave"]; + monthAriaLabelPrefix?: MonthProps["ariaLabelPrefix"]; + handleOnDayKeyDown?: MonthProps["handleOnKeyDown"]; + handleOnKeyDown?: ( + event: + | React.KeyboardEvent + | React.KeyboardEvent + | React.KeyboardEvent, + ) => void; + onTimeChange?: TimeProps["onChange"] | InputTimeProps["onChange"]; + timeFormat?: TimeProps["format"]; + timeIntervals?: TimeProps["intervals"]; + } & ( + | ({ + showMonthYearDropdown: true; + } & Pick) + | ({ + showMonthYearDropdown?: never; + } & Pick & + Pick & + Pick) + ) +>; interface CalendarState extends Pick,