Skip to content

Commit

Permalink
Fixes #37 Added propTypes object of shape snippet
Browse files Browse the repository at this point in the history
  • Loading branch information
xabikos committed Apr 16, 2018
1 parent 544d515 commit fbe02b4
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,8 @@ For example ```pta``` creates the ```PropTypes.array``` and ```ptar``` creates t
| `ptaor→` | `PropTypes.arrayOf(PropTypes.number).isRequired,` |
| `ptoo→` | `PropTypes.objectOf(PropTypes.number),` |
| `ptoor→` | `PropTypes.objectOf(PropTypes.number).isRequired,` |
| `ptoos→` | `PropTypes.objectOf(PropTypes.shape()),` |
| `ptoosr→`| `PropTypes.objectOf(PropTypes.shape()).isRequired,` |
| `ptsh→` | `PropTypes.shape({color: PropTypes.string, fontSize: PropTypes.number}),` |
| `ptshr→` | `PropTypes.shape({color: PropTypes.string, fontSize: PropTypes.number}).isRequired,` |

Expand Down
10 changes: 10 additions & 0 deletions snippets/snippets.json
Original file line number Diff line number Diff line change
Expand Up @@ -289,6 +289,16 @@
"body": "PropTypes.objectOf($0).isRequired,",
"description": "An object with property values of a certain type required"
},
"propTypeObjectOfShape": {
"prefix": "ptoos",
"body": "PropTypes.objectOf(PropTypes.shape($0)),",
"description": "An object whose keys are known ahead of time"
},
"propTypeObjectOfShapeRequired": {
"prefix": "ptoosr",
"body": "PropTypes.objectOf(PropTypes.shape($0)).isRequired,",
"description": "An object whose keys are known ahead of time required"
},
"propTypeShape": {
"prefix": "ptsh",
"body": "PropTypes.shape({\n\t$0\n}),",
Expand Down

0 comments on commit fbe02b4

Please sign in to comment.