dillon1000/react

Commit

Introduce PropTypes.shape

This diff introduces PropType.shape which lets you type an object. PropType.object was already defined and since it isn't a function I couldn't really overload the meaning to also accept a type list. Instead of doing hackery, I decided to name it `shape`.

An example where this could be used is style:

```
  propTypes: {
    style: PropTypes.shape({
      color: PropStyle.string,
      fontSize: PropTypes.number
    })
  }
```
Browse files
Changed paths2 files
First-parent comparison
M src/core/ReactPropTypes.js ModifiedM src/core/__tests__/ReactPropTypes-test.js Modified
Patch

Files changed

Rendering syntax-highlighted changes…