Skip to content

Commit

Permalink
Minimize differences between types and types inferred from propTypes
Browse files Browse the repository at this point in the history
  • Loading branch information
wojtekmaj committed Jul 25, 2023
1 parent 7c6f761 commit ea20e12
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
4 changes: 2 additions & 2 deletions src/Calendar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -843,7 +843,7 @@ Calendar.propTypes = {
minDate: isMinDate,
minDetail: PropTypes.oneOf(allViews),
navigationAriaLabel: PropTypes.string,
navigationAriaLive: PropTypes.oneOf(['off', 'polite', 'assertive']),
navigationAriaLive: PropTypes.oneOf(['off', 'polite', 'assertive'] as const),
navigationLabel: PropTypes.func,
next2AriaLabel: PropTypes.string,
next2Label: PropTypes.node,
Expand All @@ -863,7 +863,7 @@ Calendar.propTypes = {
prev2Label: PropTypes.node,
prevAriaLabel: PropTypes.string,
prevLabel: PropTypes.node,
returnValue: PropTypes.oneOf(['start', 'end', 'range']),
returnValue: PropTypes.oneOf(['start', 'end', 'range'] as const),
selectRange: PropTypes.bool,
showDoubleView: PropTypes.bool,
showFixedNumberOfWeeks: PropTypes.bool,
Expand Down
5 changes: 4 additions & 1 deletion src/shared/propTypes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,10 @@ const calendarTypes = Object.values(CALENDAR_TYPES);
const deprecatedCalendarTypes = Object.values(DEPRECATED_CALENDAR_TYPES);
const allViews = ['century', 'decade', 'year', 'month'];

export const isCalendarType = PropTypes.oneOf([...calendarTypes, ...deprecatedCalendarTypes]);
export const isCalendarType = PropTypes.oneOf([
...calendarTypes,
...deprecatedCalendarTypes,
] as const);

export const isClassName = PropTypes.oneOfType([
PropTypes.string,
Expand Down

0 comments on commit ea20e12

Please sign in to comment.