<DateCalendar
  displayWeekNumber={displayWeekNumber}
  // Cast the custom component to the type expected by the X component
  slots={{
    calendarHeader:
      CustomCalendarHeader as DateCalendarSlots['calendarHeader'],
  }}
  slotProps={{
    calendarHeader: {
      displayWeekNumber,
      setDisplayWeekNumber,
    } as DateCalendarSlotProps['calendarHeader'],
  }}
/>