From ec4bd3aad8fcf8b0cf5df213dea87b52dfe5c903 Mon Sep 17 00:00:00 2001 From: Wojciech Maj Date: Wed, 26 Jul 2023 10:05:20 +0200 Subject: [PATCH] Improve propTypes --- src/shared/propTypes.ts | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/shared/propTypes.ts b/src/shared/propTypes.ts index e40be52b..821ba16c 100644 --- a/src/shared/propTypes.ts +++ b/src/shared/propTypes.ts @@ -82,9 +82,14 @@ export const isRef = PropTypes.oneOfType([ }), ]); +const isRange = PropTypes.arrayOf( + PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.oneOf([null])]).isRequired, +) as Requireable>; + 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));