Skip to content

Commit 010ca68

Browse files
committed
Improve propTypes in ValueOptions
1 parent 400becb commit 010ca68

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

test/ValueOptions.jsx

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -83,11 +83,11 @@ export default function ValueOptions({ setValue, value }) {
8383
);
8484
}
8585

86+
const isValue = PropTypes.oneOfType([PropTypes.string, PropTypes.instanceOf(Date)]);
87+
88+
const isValueOrValueArray = PropTypes.oneOfType([isValue, PropTypes.arrayOf(isValue)]);
89+
8690
ValueOptions.propTypes = {
8791
setValue: PropTypes.func.isRequired,
88-
value: PropTypes.oneOfType([
89-
PropTypes.string,
90-
PropTypes.instanceOf(Date),
91-
PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.string, PropTypes.instanceOf(Date)])),
92-
]),
92+
value: isValueOrValueArray,
9393
};

0 commit comments

Comments
 (0)