Skip to content

Commit c82d464

Browse files
committed
Improve propTypes in ValueOptions
1 parent 2198221 commit c82d464

File tree

2 files changed

+5
-9
lines changed

2 files changed

+5
-9
lines changed

test/ValueOptions.tsx

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@ import React from 'react';
22
import PropTypes from 'prop-types';
33
import { getISOLocalDateTime } from '@wojtekmaj/date-utils';
44

5-
import { isValue } from './shared/propTypes';
6-
75
import type { LooseValue } from './shared/types';
86

97
type ValueOptionsProps = {
@@ -117,9 +115,13 @@ export default function ValueOptions({
117115
);
118116
}
119117

118+
const isValue = PropTypes.oneOfType([PropTypes.string, PropTypes.instanceOf(Date)]);
119+
120+
const isValueOrValueArray = PropTypes.oneOfType([isValue, PropTypes.arrayOf(isValue)]);
121+
120122
ValueOptions.propTypes = {
121123
selectRange: PropTypes.bool,
122124
setSelectRange: PropTypes.func.isRequired,
123125
setValue: PropTypes.func.isRequired,
124-
value: PropTypes.oneOfType([PropTypes.string, isValue]),
126+
value: isValueOrValueArray,
125127
};

test/shared/propTypes.ts

Lines changed: 0 additions & 6 deletions
This file was deleted.

0 commit comments

Comments
 (0)