Skip to content

Commit

Permalink
Improve propTypes
Browse files Browse the repository at this point in the history
  • Loading branch information
wojtekmaj committed Jul 26, 2023
1 parent 4cd3dc3 commit ec4bd3a
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/shared/propTypes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -82,9 +82,14 @@ export const isRef = PropTypes.oneOfType([
}),
]);

const isRange = PropTypes.arrayOf(
PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.oneOf([null])]).isRequired,
) as Requireable<Range<Date>>;

export const isValue = PropTypes.oneOfType([
PropTypes.instanceOf(Date),
PropTypes.arrayOf(PropTypes.instanceOf(Date)),
PropTypes.oneOf([null]),
isRange,
]);

export const isViews = PropTypes.arrayOf(PropTypes.oneOf(allViews));
Expand Down

0 comments on commit ec4bd3a

Please sign in to comment.