@@ -74,7 +74,7 @@ export interface CalendarCellAria {
7474 */
7575export function useCalendarCell ( props : AriaCalendarCellProps , state : CalendarState | RangeCalendarState , ref : RefObject < HTMLElement | null > ) : CalendarCellAria {
7676 let { date, isDisabled} = props ;
77- let { errorMessageId, selectedDateDescription} = hookData . get ( state ) ;
77+ let { errorMessageId, selectedDateDescription} = hookData . get ( state ) ! ;
7878 let stringFormatter = useLocalizedStringFormatter ( intlMessages , '@react-aria/calendar' ) ;
7979 let dateFormatter = useDateFormatter ( {
8080 weekday : 'long' ,
@@ -89,7 +89,7 @@ export function useCalendarCell(props: AriaCalendarCellProps, state: CalendarSta
8989 isDisabled = isDisabled || state . isCellDisabled ( date ) ;
9090 let isUnavailable = state . isCellUnavailable ( date ) ;
9191 let isSelectable = ! isDisabled && ! isUnavailable ;
92- let isInvalid = state . isValueInvalid && (
92+ let isInvalid = state . isValueInvalid && Boolean (
9393 'highlightedRange' in state
9494 ? ! state . anchorDate && state . highlightedRange && date . compare ( state . highlightedRange . start ) >= 0 && date . compare ( state . highlightedRange . end ) <= 0
9595 : state . value && isSameDay ( state . value , date )
@@ -159,7 +159,7 @@ export function useCalendarCell(props: AriaCalendarCellProps, state: CalendarSta
159159
160160 let isAnchorPressed = useRef ( false ) ;
161161 let isRangeBoundaryPressed = useRef ( false ) ;
162- let touchDragTimerRef = useRef ( null ) ;
162+ let touchDragTimerRef = useRef < ReturnType < typeof setTimeout > | undefined > ( undefined ) ;
163163 let { pressProps, isPressed} = usePress ( {
164164 // When dragging to select a range, we don't want dragging over the original anchor
165165 // again to trigger onPressStart. Cancel presses immediately when the pointer exits.
@@ -195,7 +195,7 @@ export function useCalendarCell(props: AriaCalendarCellProps, state: CalendarSta
195195
196196 let startDragging = ( ) => {
197197 state . setDragging ( true ) ;
198- touchDragTimerRef . current = null ;
198+ touchDragTimerRef . current = undefined ;
199199
200200 state . selectDate ( date ) ;
201201 state . setFocusedDate ( date ) ;
@@ -215,7 +215,7 @@ export function useCalendarCell(props: AriaCalendarCellProps, state: CalendarSta
215215 isRangeBoundaryPressed . current = false ;
216216 isAnchorPressed . current = false ;
217217 clearTimeout ( touchDragTimerRef . current ) ;
218- touchDragTimerRef . current = null ;
218+ touchDragTimerRef . current = undefined ;
219219 } ,
220220 onPress ( ) {
221221 // For non-range selection, always select on press up.
@@ -269,7 +269,7 @@ export function useCalendarCell(props: AriaCalendarCellProps, state: CalendarSta
269269 }
270270 } ) ;
271271
272- let tabIndex = null ;
272+ let tabIndex : number | undefined = undefined ;
273273 if ( ! isDisabled ) {
274274 tabIndex = isSameDay ( date , state . focusedDate ) ? 0 : - 1 ;
275275 }
@@ -298,14 +298,14 @@ export function useCalendarCell(props: AriaCalendarCellProps, state: CalendarSta
298298 calendar : date . calendar . identifier
299299 } ) ;
300300
301- let formattedDate = useMemo ( ( ) => cellDateFormatter . formatToParts ( nativeDate ) . find ( part => part . type === 'day' ) . value , [ cellDateFormatter , nativeDate ] ) ;
301+ let formattedDate = useMemo ( ( ) => cellDateFormatter . formatToParts ( nativeDate ) . find ( part => part . type === 'day' ) ! . value , [ cellDateFormatter , nativeDate ] ) ;
302302
303303 return {
304304 cellProps : {
305305 role : 'gridcell' ,
306- 'aria-disabled' : ! isSelectable || null ,
307- 'aria-selected' : isSelected || null ,
308- 'aria-invalid' : isInvalid || null
306+ 'aria-disabled' : ! isSelectable || undefined ,
307+ 'aria-selected' : isSelected || undefined ,
308+ 'aria-invalid' : isInvalid || undefined
309309 } ,
310310 buttonProps : mergeProps ( pressProps , {
311311 onFocus ( ) {
@@ -315,11 +315,11 @@ export function useCalendarCell(props: AriaCalendarCellProps, state: CalendarSta
315315 } ,
316316 tabIndex,
317317 role : 'button' ,
318- 'aria-disabled' : ! isSelectable || null ,
318+ 'aria-disabled' : ! isSelectable || undefined ,
319319 'aria-label' : label ,
320- 'aria-invalid' : isInvalid || null ,
320+ 'aria-invalid' : isInvalid || undefined ,
321321 'aria-describedby' : [
322- isInvalid ? errorMessageId : null ,
322+ isInvalid ? errorMessageId : undefined ,
323323 descriptionProps [ 'aria-describedby' ]
324324 ] . filter ( Boolean ) . join ( ' ' ) || undefined ,
325325 onPointerEnter ( e ) {
0 commit comments