🏷️(react) fix types issue
Since upgrade of @react-stately/calendar, a type issue was emit and broke the build.
This commit is contained in:
committed by
Jean-Baptiste PENRATH
parent
06d32d9af6
commit
dbd5f05652
@@ -16,7 +16,7 @@ interface CalendarCellProps {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const isRangeCalendar = (object: any): object is RangeCalendarState => {
|
const isRangeCalendar = (object: any): object is RangeCalendarState => {
|
||||||
return object?.highlightedRange;
|
return Boolean(object?.highlightedRange);
|
||||||
};
|
};
|
||||||
|
|
||||||
export const CalendarCell = ({ state, date }: CalendarCellProps) => {
|
export const CalendarCell = ({ state, date }: CalendarCellProps) => {
|
||||||
@@ -31,15 +31,15 @@ export const CalendarCell = ({ state, date }: CalendarCellProps) => {
|
|||||||
} = useCalendarCell({ date }, state, ref);
|
} = useCalendarCell({ date }, state, ref);
|
||||||
|
|
||||||
const isSelectionEnd =
|
const isSelectionEnd =
|
||||||
isRangeCalendar(state) && isSameDay(date, state?.highlightedRange?.end);
|
isRangeCalendar(state) && isSameDay(date, state.highlightedRange!.end);
|
||||||
|
|
||||||
const isSelectionStart =
|
const isSelectionStart =
|
||||||
isRangeCalendar(state) && isSameDay(date, state?.highlightedRange?.start);
|
isRangeCalendar(state) && isSameDay(date, state?.highlightedRange!.start);
|
||||||
|
|
||||||
const isWithinHighlightedRange =
|
const isWithinHighlightedRange =
|
||||||
isRangeCalendar(state) &&
|
isRangeCalendar(state) &&
|
||||||
state?.highlightedRange?.start <= date &&
|
state?.highlightedRange!.start <= date &&
|
||||||
state?.highlightedRange?.end >= date;
|
state?.highlightedRange!.end >= date;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<td {...cellProps}>
|
<td {...cellProps}>
|
||||||
|
|||||||
Reference in New Issue
Block a user