Skip to content
This repository has been archived by the owner on Sep 1, 2024. It is now read-only.

mapOf and setOf validators #289

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
## 15.7.3
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

adding a new thing is semver-minor

Suggested change
## 15.7.3
## 15.8.0

* [New] Add `.tupleOf`, `.iterableOf`, `.mapOf`, and `.setOf` ([#289](https://github.com/facebook/prop-types/pull/289))

## 15.7.2
* [Fix] ensure nullish values in `oneOf` do not crash ([#256](https://github.com/facebook/prop-types/issues/256))
* [Fix] move `loose-envify` back to production deps, for browerify usage ([#203](https://github.com/facebook/prop-types/issues/203))
Expand Down
12 changes: 12 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,18 @@ MyComponent.propTypes = {
// An array of a certain type
optionalArrayOf: PropTypes.arrayOf(PropTypes.number),

// A two item array of [string, number]
optionalTupleOf: PropTypes.tupleOf([PropTypes.string, PropTypes.number]),

// An iterable of a certain type
optionalIterableOf: PropTypes.iterableOf(PropTypes.number),

// An es6 Map containing certain types of keys and values
optionalMapOf: PropTypes.mapOf([PropTypes.string, PropTypes.number]),

// An es6 Set containing certain types of values
optionalSetOf: PropTypes.setOf(PropTypes.number),

// An object with property values of a certain type
optionalObjectOf: PropTypes.objectOf(PropTypes.number),

Expand Down
Loading