Validate Prop Types
This package is a modified version of PropTypes.checkPropTypes()
, the difference
being that it returns errors as an object instead of issuing a console.error
.
ExampleComponent.js
const PropTypes = const ExampleComponent = 'hello' ExampleComponentpropTypes = a: PropTypesstringisRequired b: PropTypesnumber c: PropTypesobject
ExampleComponent.test.js
const assert = const validatePropTypes = const ExampleComponent = const data = b: 'a string' c: 'another string' assert